APP版本检测
- 作者: 嗫?暁雲?
- 来源: 51数据库
- 2022-08-17
NSString *version = @""; NSURL *url = [NSURL URLWithString:@"http://www.51sjk.com/Upload/Articles/1/0/323/323233_20220817162716895.jpg app ID>"]; versionRequest = [ASIFormDataRequest requestWithURL:url]; [versionRequest setRequestMethod:@"GET"]; [versionRequest setDelegate:self]; [versionRequest setTimeOutSeconds:150]; [versionRequest addRequestHeader:@"Content-Type" value:@"application/json"]; [versionRequest startSynchronous]; //Response string of our REST call NSString* jsonResponseString = [versionRequest responseString]; NSDictionary *loginAuthenticationResponse = [jsonResponseString objectFromJSONString]; NSArray *configData = [loginAuthenticationResponse valueForKey:@"results"]; for (id config in configData) { version = [config valueForKey:@"version"]; } //Check your version with the version in app store if (![version isEqualToString:[itsUserDefaults objectForKey:@"version"]]) { ProAlertView *createUserResponseAlert = [[ProAlertView alloc] initWithTitle:@"New Version!!" message: @"A new version of app is available to download" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles: @"Download", nil]; [createUserResponseAlert show]; [createUserResponseAlert release]; }
推荐阅读