Good practices for a push iOS app?
I'm writing a newsfeed app (with push), and I'd like it to handle the following scenarios gracefully:
- App is launched/resumed, and it checks for new posts upon appearing
- App is launched/resumed, it knows that there are new posts (d开发者_Python百科ue to the badge being set up), but the network is encountering problems etc.
I can imagine a plenty of weird scenarios happening. For example - the user launches the app, starts browsing news and then new ones appear. Or there is no internet connection, but the app tries to download new data blocking user from performing certain actions... and so on.
Is there a good set of practices for this kinds of apps? I'm using ASI package if this changes anything, and the newsfeed is displayed in a single UIWebView (so I cannot easily add new rows).
The apps that I use that do this well, have the following features
- Turn on/off automatic fetching, so I can go manual if I want
- All network activity is completely in background threads
- All views live update when they are ready
- Network activity indicator
If using UIWebView stops you from having these features, then I think you will be at a huge disadvantage. For just a table of information, using UITableView is not that difficult and will be worth it for a much better experience.
Even with UIWebView, you could probably use JavaScript and DOM manipulation to update views that are already showing.
精彩评论