简体   繁体   中英

iOS - Prompt User to Update to Latest App Version

Is there any method or plugin available that will alert the user to upgrade an app if the version they are using is not the latest? I suppose I could ping a web service to check what the current version is and compare with the user's version and go from there. As an aside, is there a way to check the current version of the app (some property I don't know about) or do you simply have to hardcode the version as some float variable or something?

Thanks

There's a nice little open source library available called Harpy that will accomplish this for you! It provides the ability to check for updates on startup, daily, or weekly, and it uses itunes to do the checking, so config is really minimal.

you will need to build the update check functionality yourself. however you can get the version info from the app.

NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];

Bear in mind tho that just because you have an app up. and it has been released into the store. that does not mean the app is immediately available to all users via the app store.

You'll have to build such a solution yourself. There's no update-checking functionality provided by the iOS SDK.

Most apps just check a website or similar, as you've already considered.

You can grab the version from the info.plist with

    NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
self.applicationVersion = [infoDict objectForKey:@"CFBundleVersion"];
self.applicationBuild = [infoDict objectForKey:@"CFBundleShortVersionString"];

And, yes just hit a web service. Or even easier you could just put a file up on S3 and update that with your version number.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM