0
由於某些原因,每當我在我的應用程序中運行下面的代碼時,狀態欄消失。我在applicationaitonLaunchOptions結尾處運行,上面返回YES。狀態欄隱藏時運行代碼
有誰知道爲什麼會發生這種情況?
下面的代碼詢問人們是否要升級到新的應用程序版本。
NSString * version = @"";
NSString * nstri = [NSString stringWithFormat: @"http://itunes.apple.com/lookup?id=%@", APPID];
NSURL *url = [NSURL URLWithString: nstri];
ASIFormDataRequest * 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"];
}
NSLog(@"app version: %@", version);
//Check your version with the version in app store
if (![version isEqualToString: APPVERSION])
{
UIAlertView *createUserResponseAlert = [[UIAlertView alloc] initWithTitle:@"New Version!" message: @"A new version of Handybook app is available to download. Please update your app for the latest features." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles: @"Download", nil];
[createUserResponseAlert show];
}
請不要在主線上做同步聯網!這讓我哭。 – 2013-02-10 08:40:03