0
我有一個if語句在應用程序委託的application DidFinishLaunchingWithOptions
。即使if語句不正確,if語句中的代碼也會運行。難道我做錯了什麼?它似乎忽略了if語句。應用程序didFinishLaunchingWithOptions忽略如果語句
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSInteger i = [[NSUserDefaults standardUserDefaults] integerForKey:@"numOfLCalls"];
[[NSUserDefaults standardUserDefaults] setInteger:i+1 forKey:@"numOfLCalls"];
if (i >= 3) {
UIAlertView *alert_View = [[UIAlertView alloc] initWithTitle:@"Hey! You are still coming back!" message:@"It would mean a whole lot to me if you rated this app!" delegate:self cancelButtonTitle:@"Maybe later" otherButtonTitles: @"Rate", nil];
[alert_View show];
}
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
如果您登錄「我」它適當增加? –
@NDPostWhenIdle我沒有嘗試過,但我只是,並輸出控制檯6.我不知道如何或爲什麼發生。 –
好吧,所以條件'i> = 3'是真的,但警報沒有顯示? –