目前有如此多的更新检查器使用 UIAlertView 来提示用户升级您的应用,但警报会阻止用户操作。 AWVersionAgent 将在后台检查新版本,并通过本地通知通知用户新版本可用。
application:didFinishLaunchingWithOptions: 中添加 [[AWVersionAgent sharedAgent] checkNewVersionForApp:@"your-app-id"]; 以在后台检查新版本。application:didReceiveLocalNotification: 中添加 [[AWVersionAgent sharedAgent] upgradeAppWithNotification:notification]; 以响应本地通知。[[AWVersionAgent sharedAgent] setDebug:YES]; 启用调试模式。- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self.window makeKeyAndVisible];
[[AWVersionAgent sharedAgent] checkNewVersion];
return YES;
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[[AWVersionAgent sharedAgent] upgradeAppWithNotification:notification];
}AWVersionAgent 在 MIT 许可证下提供。