开发者

Approach for adding favorites tab

Which approach is best to adding into favorites tab.

开发者_StackOverflow中文版

I need to add all my events which are in array. calling from web service. two ways i can add to favorites...

  1. adding into local...

USing nsuserdefaults...encoding and decoding......

or i can depend on web-service... create a web service. for favorites and fetch data from web service. when i click add favoirtes button.. it send device id and event id to web - service and created respective event in web service.. where i can fetch data from web service.

i got two ways approach which is best.

Can any one help me out.

@thanks in advance.


It's hard to give a good example without knowing more about what you'll be storing as "favourites", but as a general approach you should store the data locally so that's it's accessible if the internet/remote server is not available.

However, if the data is of value outside the application (or needs to be synced with other devices, etc.) the application should periodically communicate with the remote server to sync the favourites data.

In other words, you should (potentially) use a mix of both approaches.

UPDATE

In terms of saving data on the device itself, you might want to take a look at the NSKeyedArchiver and indeed Apple's Archives and Serializations Programming Guide - this will tell you everything you need to know about serialising data and subsequently storing it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜