Thyme释念帅
Thyme释念帅
  • 发布:2016-09-22 16:44
  • 更新:2016-09-22 16:44
  • 阅读:1299

你好,我想问下iOS本地推送那功能你实现了吗

分类:Native.js

我现在想要到某个时间点给用户一个提醒,用本地推送实现这个功能,但是我写的实现不了功能
var notification = plus.ios.newObject('UILocalNotification');
var fireDate = plus.ios.invoke('NSDate', 'dateWithTimeIntervalSinceNow:', 5);
console.log("fireDate"+JSON.stringify(fireDate));
notification.plusSetAttribute('fireDate', fireDate);
notification.plusSetAttribute('timeZone', plus.ios.invoke('NSTimeZone', 'defaultTimeZone'));
notification.plusSetAttribute('repeatInterval', 'kCFCalendarUnitSecond');
notification.plusSetAttribute('alertBody', "你有一条通知还有人未确认,请前往知到APP查看详情");
notification.plusSetAttribute('applicationIconBadgeNumber', 1);
notification.plusGetAttribute('soundName', 'UILocalNotificationDefaultSoundName');
var UIApplication = plus.ios.import("UIApplication");
var sharedApplication = UIApplication.sharedApplication();
if(sharedApplication.respondsToSelector(plus.ios.newObject("@selector", "registerUserNotificationSettings:"))) {
var type = 7;
var settings = plus.ios.invoke('UIUserNotificationSettings','settingsForTypes:categories:',type,null);
sharedApplication.registerUserNotificationSettings(settings);
notification.plusSetAttribute('repeatInterval','NSCalendarUnitDay');
} else {
notification.plusSetAttribute('repeatInterval','NSDayCalendarUnit');
}
console.log("111111111111111111111111111111111111111100000");
sharedApplication.scheduleLocalNotification(notification);

2016-09-22 16:44 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复