本地通知不适用于IOS8 cordova

时间:2014-12-24 11:06:34

标签: iphone cordova ios8

通知在IOS7(iPhone 4)上完美运行,但无效IOS8 (iPad) 通知代码是:

var notificationObject = {
                  id:abc,
                  title:'Prayer Time',
                  message:'Dont forget to buy some flowers.',
                  // repeat:'weekly',
                  date:null,
                 json: JSON.stringify({
                    category: cat,start_time:startTime,end_time:endTime }
                                      )
              };

              var  notificationObjectMonday = jQuery.extend(notificationObject, {
                  date : newactualdate
               });

            window.plugin.notification.local.add(notificationObjectMonday);

1 个答案:

答案 0 :(得分:0)

//for iOS8 you need to set permission for local notifications
//Registering user notification settings,

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
// Override point for customization after application launch.
if(UIApplication.instancesRespondToSelector(Selector("registerUserNotificationSettings:")))
{
    application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge, categories: nil))
}
else
{
   //do iOS 7 stuff, which is pretty much nothing for local notifications.
}
return true

}