1

我知道如何安排 localNotification 并在推送 localNotification 时设置 applicationIconBadgeNumber:

- (void) scheduleNotificationOn:(NSDate*) fireDate
                            text:(NSString*) alertText
                            action:(NSString*) alertAction
                             sound:(NSString*) soundfileName
                       launchImage:(NSString*) launchImage 
                           andInfo:(NSDictionary*) userInfo
{

    UILocalNotification *localNotification = [[UILocalNotification alloc] init];
    localNotification.fireDate = fireDate;

    ....

    self.badgeCount ++;
    localNotification.applicationIconBadgeNumber = self.badgeCount;         

    // Schedule it with the app
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
    [localNotification release];
}

如代码所示,在调用 localNotification 之前设置了 applicationIconBadgeNumber。我想知道是否可以在调用 localNotification 时计算 applicationIconBadgeNumber 并将其显示在应用程序图标附近?

4

1 回答 1

0

不,你不能。除非您的应用程序在前台运行,否则您可能会触发本地通知。

于 2013-03-07T03:09:37.473 回答