2

单击通知后,所有通知都会被清除。在ios中,是否有任何选项可以在点击通知后清除单个通知?我收到了 4 条通知。现在我需要单独点击的通知来清除并保留其他通知。有人可以帮我吗?在此处输入图像描述

- (void) clearNotifications {
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
    [[UIApplication sharedApplication] cancelAllLocalNotifications];
}

- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo
{    
    NSLog(@"Received notification: %@", userInfo);
    [self clearNotifications];
}
4

1 回答 1

-1
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{

// when you tap on any of notification this delegate method will call... 

    [[UIApplication sharedApplication] cancelLocalNotification:notification];

}
于 2013-06-15T05:53:23.307 回答