iOS应用程序更新机制如何工作?如何告诉用户Appstore上的应用程序已更新?我是否必须在代码中编写功能以显示更新弹出窗口,还是由Appstore处理以向用户显示应用程序已更新的通知?苹果有为此提供任何文件吗?
例如:http://itunes.apple.com/jp/lookup/?id=1005582646
对于美国应用程序,例如:http://itunes.apple.com/lookup/?id=myAppIDNumberFromTheAppStore
请注意,这是与App Store Connect API分开。如果使用它,则需要在发出请求之前生成令牌。请先查看API上的文档,否则您将得到带有空结果的响应。
https://developer.apple.com/documentation/appstoreconnectapi
https://developer.apple.com/documentation/appstoreconnectapi/generating_tokens_for_api_requests
iTunes API的响应具有"version"
字段内的"results"
字段。它具有App Store上最新版本的版本号。
在AppDelegate->didFinishLaunchingWithOptions
中,您可以调用上述API。
Obj-C。
NSString *currentAppVersion = [[[NSBundle mainBundle]
infoDictionary] objectForKey:@"CFBundleShortVersionString"];
迅捷(4.2)
var currentAppVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
现在,您可以比较1和2中的版本号,以在App Store上有更新的应用程序时向用户显示警报或通知。