Point 2:如果您不希望用户稍后更新,则应仅允许强制更新作为选项。以编程方式关闭应用程序不是正确的选择。
Point 1:您可以使用一个可用的良好库来实现此目的。
在斯威夫特中的用法:
Library https://github.com/ArtSabintsev/Siren
func applicationDidBecomeActive(application: UIApplication) {
/* Perform daily (.daily) or weekly (.weekly) checks for new version of your app.
Useful if user returns to your app from the background after extended period of time.
Place in applicationDidBecomeActive(_:)*/
Siren.shared.checkVersion(checkType: .daily)
}
Objective-C 中的用法: Library https://github.com/ArtSabintsev/Harpy
-(void)applicationDidBecomeActive:(UIApplication *)application {
// Perform daily check for new version of your app
[[Harpy sharedInstance] checkVersionDaily];
}
它是如何工作的:它使用查找 API 返回应用程序详细信息,例如link http://textuploader.com/d6r9g包括版本并进行比较。
例如,通过调用 iTunes ID 查找 Yelp 软件应用程序https://itunes.apple.com/lookup?id=284910350 https://itunes.apple.com/lookup?id=284910350
欲了解更多信息,请访问link https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#lookup