ios - How to check if the app was already installed -


i have app want make update it.

i have list of items in application, want add versions items, when item updated marked updated. or if add new item marked new.

but new users install app first time items should new, , users have app on devices items should without mark intially. don't have user defaults in app can't check value.

how can check if app installed on device?

the answer you cannot know if didn't store information check if user updating app or installing scratch.

you can use code know it, starting version implement in.

bool versionupgraded; nsstring *version = [[[nsbundle mainbundle] infodictionary] objectforkey:@"cfbundleversion"]; nsstring *previousversion = [prefs stringforkey:@"appversion"];  if ([[nsuserdefaults standarduserdefaults] stringforkey:@"appversion"] != nil)  {     // see if version same previous one. if not, update.     versionupgraded = !([previousversion isequaltostring: version]); }  // no "appversion" means new install. else  {     versionupgraded = yes;  }  if (versionupgraded)  {     [[nsuserdefaults standarduserdefaults] setobject:version                                                forkey:@"appversion"];     [[nsuserdefaults standarduserdefaults] setobject:previousversion                                                       forkey:@"prevappversion"];     [[nsuserdefaults standarduserdefaults] synchronize]; } 

what can check if there data cache, store etc. in nsuserdefaults, or kind of database, or documents folder, mean the app installed.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -