0
我發現了一些討論這個並將其實現到我的代碼中的線程,但是我有一個錯誤。跟蹤發佈bug
我正在嘗試每5次發射一次。
另外的代碼設置launchAmounts
,是建於到userDefaults
,或做我必須聲明這個地方?
我在我的主視圖控制器中從viewwillappear
這樣做。
NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults];
NSInteger appLaunchAmounts = [userDefaults integerForKey:@"LaunchAmounts"];
appLaunchAmounts = appLaunchAmounts %5;
NSLog(@"app has been launched = %d", appLaunchAmounts);
[userDefaults setInteger:appLaunchAmounts+1 forKey:@"LaunchAmounts"];
if (appLaunchAmounts==0) {
什麼是錯誤? – mttrb
爲什麼'appLaunchAmounts = appLaunchAmounts%5'? – trojanfoe
我想它是多餘的?它應該是如果(applaunchamounts%5 == 0){...? –