0

出于某种原因,每当我在我的应用程序中运行以下代码时,状态栏就会消失。我在上面的 applicaitonLaunchOptions 结束时运行返回 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];

}
4

1 回答 1

0

可能是您的 AppDeleget.m 中有此代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *) launchOptions {
    [[UIApplication sharedApplication] setStatusBarHidden:YES with Animation:NO];
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
}

如果是,则熄灭:

[[UIApplication sharedApplication] setStatusBarHidden:YES with Animation:NO];

因为那行代码隐藏了状态栏

于 2013-02-10T12:01:35.607 回答