Ios5 本地通知停止出现?

Ios5 本地通知停止出现?,ios5,uilocalnotification,Ios5,Uilocalnotification,我最近为客户端开发了一个包含本地通知的应用程序。在原始版本中,通知工作得非常好。但是,当客户端试图发布另一个版本时,仅更改了映像,而DB资源的代码没有更改,通知停止工作。现在我一直在调试代码,但什么也没找到。一切似乎都很好,但没有通知。同时,如果我运行早期的构建,它工作得非常完美。你能帮我找出哪里不对劲吗?非常感谢您抽出时间 NSTimeInterval diffTimeIntervalSinceNow = timeInterval; //time-interval after which no

我最近为客户端开发了一个包含本地通知的应用程序。在原始版本中,通知工作得非常好。但是,当客户端试图发布另一个版本时,仅更改了映像,而DB资源的代码没有更改,通知停止工作。现在我一直在调试代码,但什么也没找到。一切似乎都很好,但没有通知。同时,如果我运行早期的构建,它工作得非常完美。你能帮我找出哪里不对劲吗?非常感谢您抽出时间

NSTimeInterval diffTimeIntervalSinceNow = timeInterval; //time-interval after which notification should appear


    UILocalNotification *localNotification = [[UILocalNotification alloc] init]; //Create the localNotification object
    [localNotification setFireDate:[NSDate dateWithTimeIntervalSinceNow:diffTimeIntervalSinceNow]]; //Set the date when the alert will be launched using the date adding the time the user selected on the timer
    //[localNotification setRepeatInterval:notificationInterval];

    [localNotification setAlertAction:@"Launch"]; //The button's text that launches the application and is shown in the alert
    [localNotification setAlertBody:alertBody]; //Set the message in the notification from the textField's text
    [localNotification setHasAction: YES]; //Set that pushing the button will launch the application
    [localNotification setApplicationIconBadgeNumber:[[UIApplication sharedApplication] applicationIconBadgeNumber]+1]; //Set the Application Icon Badge Number of the application's icon to the current Application Icon Badge Number plus 1

    [[UIApplication sharedApplication] cancelAllLocalNotifications];
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; //Schedule the notification with the system
    [localNotification release];
这就是我一直在使用的代码。但这与早期版本中的代码完全相同。

我更正了您的代码:- 试试这个:-按钮动作或任何方法的内部

  [[UIApplication sharedApplication] cancelAllLocalNotifications];
       NSTimeInterval diffTimeIntervalSinceNow = timeInterval; //time-interval after which notification should appear


            UILocalNotification *localNotification = [[UILocalNotification alloc] init]; //Create the localNotification object
            [localNotification setFireDate:[NSDate dateWithTimeIntervalSinceNow:diffTimeIntervalSinceNow]]; //Set the date when the alert will be launched using the date adding the time the user selected on the timer
            //[localNotification setRepeatInterval:notificationInterval];

            [localNotification setAlertAction:@"Launch"]; //The button's text that launches the application and is shown in the alert
            [localNotification setAlertBody:alertBody]; //Set the message in the notification from the textField's text
            [localNotification setHasAction: YES]; //Set that pushing the button will launch the application
            [localNotification setApplicationIconBadgeNumber:[[UIApplication sharedApplication] applicationIconBadgeNumber]+1]; //Set the Application Icon Badge Number of the application's icon to the current Application Icon Badge Number plus 1


            [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; //Schedule the notification with the system
            [localNotification release];
对于此工作:-请在应用程序代理获取某些事件时检查此方法

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

}

要取消所有通知,请在

中使用此选项。您的客户端可能也修改了alertBody,并且新alertBody的长度太长?

未更改任何内容。我想代码是可以的,因为我用“fileMerge”比较了这两个类,没有任何区别。