2011-02-19 57 views
0

我需要顯示3日,10日和20日推出的應用程序的NSAlert,到目前爲止,我曾嘗試:顯示NSAlert具體的發佈

/* Note that the kLaunchCount is incremented as a Number in a dictionary */ 
if([[[NSUserDefaults standardUserDefaults] objectForKey:@"kLaunchCount"] intValue] == 1||2||3) 
{ 
    /* show the NSAlert */ 
} 

上面的代碼顯示了NSAlert每次啓動。

回答

1

該代碼解析爲...||2||3,它將始終返回true(因爲任何|| 2都是true)。您應該將啓動計數放入變量n,然後使用n == 3 || n == 10 || n == 20作爲測試。