2012-06-19 31 views

Trả lời

1

Nếu có một callback khi ứng dụng của bạn đã bị xóa, bạn có thể [[UIApplication sharedApplication] cancelAllLocalNotifications]; tuy nhiên vì điều này là không thể Tôi không thấy bất kỳ cách nào ...

2

Có lẽ trong applicationDidFinishLaunching (không kiểm tra):

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; 

BOOL firstRun = [prefs boolForKey:@"firstRun"]; 

if(firstRun) { 

    // Cancel all UILocalNotifications 

} else { 

    BOOL firstRun = NO; 
    [prefs setBool:firstRun forKey:@"firstRun"]; 

} 
1

Bạn nên thực hiện như dưới đây mã trong ứng dụng didFinishLaunchingWithOptions, Hy vọng điều này có thể được làm việc.

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; 

    // BOOL firstRun=YES; 

     BOOL firstRun = [prefs boolForKey:@"firstRun"]; 

    if(firstRun) { 
        NSArray *notificationarray = [[UIApplication sharedApplication] scheduledLocalNotifications]; 

     BOOL firstRun =NO; 
     [prefs setBool:firstRun forKey:@"firstRun"]; 

    } else { 
       BOOL firstRun = NO; 
       [prefs setBool:firstRun forKey:@"firstRun"]; 
       NSArray *notificationarray = [[UIApplication sharedApplication] scheduledLocalNotifications]; 
       NSLog(@"%@",notificationarray); 

     } 

    [prefs synchronize]; 

Hy vọng điều này sẽ giúp

Các vấn đề liên quan