开发者

Alert user with UIAlertView

开发者 https://www.devze.com 2023-03-16 16:09 出处:网络
Just need your thought on a problem and how to approach it. I have an app that normally doesn\'t ask to connect to the web (unless user desires to send an email from within the app).

Just need your thought on a problem and how to approach it. I have an app that normally doesn't ask to connect to the web (unless user desires to send an email from within the app). I d like to inform the user every now and then BUT not all the time with lets say i.e. news and daily tips etc at start up. How would you approach this? Would I just pop a uialertview at startup? And how do I prevent it from poping up all the time and only pop up whenever I have something new to say?

I'm a bit lost开发者_如何学C here, and any help would be appreciated.

Thanks


rising a notification which declares the time as approached to display an alert view is a good idea as stated by jignesh. add a notification to the method or scenario which states the situation to display an alert and when the situation occurs just display a alertView.

hope it helps u

TNQ


You can implement push notification to alert the user about new things come from server....


Ok, here's my idea.

You need a feed on your server. This you can send a time to. The time you send will be the last time you checked for new messages. The script on the server needs to return all messages AFTER the time you send.

On the app you will get the response (probably best in plist or xml format) which will contain all new messages you want to send (after the time you sent). At this point you now want to log the current time. You should use an NSUserDefault for this (so you can get all NEW messages from the server next time). You also want to put the new messages into an NSUserDefault (use a mutable array of strings).

On starting the app you want to check your NSUserDefaults to see if there are any messages (if([[defaults messagesArray] count] > 0)). If there are then UIAlertView them (one at a time). And after you do [alert show] you want to remove them from the array.

Just thinking off the top of my head, let me know if none of that makes sense! :p

0

精彩评论

暂无评论...
验证码 换一张
取 消