Robovm 本地通知未显示。调度似乎成功了。我错过了什么吗?

Robovm Local notifications not showing up. Scheduling seems successful. Am I missing something?

我正在尝试让 local/scheduled 通知正常工作。推送消息(使用 Parse)工作正常我虽然本地会很容易,但即使注册似乎很顺利(didRegisterUserNotificationSettings 被解雇)并且计划似乎也有效,但通知没有显示。我已经在 iOS 7 (iphone 4) 和 iOS 9 (iphone 模拟器) 上进行了测试。我错过了什么?

这是我的代码:

@Override
public boolean didFinishLaunching(UIApplication application,UIApplicationLaunchOptions launchOptions)    
{
 boolean retval = super.didFinishLaunching(application, launchOptions);
 //some other stuff happens here regarding parse push. But since this works I have cut it out
 registerForPush();
 return retval;

}


public void registerForPush()
{
 if (IOSLauncher.getOSMajorVersion() >= 8)
 {
 UIUserNotificationType userNotificationTypes = UIUserNotificationType.with(UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound);


 UIUserNotificationSettings settings = new UIUserNotificationSettings(userNotificationTypes, null);
 application.registerUserNotificationSettings(settings);
 application.registerForRemoteNotifications();
 }
 else
 {
 UIRemoteNotificationType type = UIRemoteNotificationType.with(UIRemoteNotificationType.Alert, UIRemoteNotificationType.Badge, UIRemoteNotificationType.Sound);
 application.registerForRemoteNotificationTypes(type);
 }
}


public void scheduleNotification(String title, String text, Date date, int ID)
{
    UILocalNotification notification = new UILocalNotification();
    if(getOSMajorVersion() >= 8 && getOSMinorVersion() >= 2)
    notification.setAlertTitle(title);
    notification.setAlertBody(text);
    notification.setFireDate(new NSDate(date));
 NSMutableDictionary<NSObject, NSObject> dict = new NSMutableDictionary<>();
 dict.put("id",NSNumber.valueOf(ID));
 notification.setUserInfo(dict);
    UIApplication.getSharedApplication().scheduleLocalNotification(notification);
}

编辑: 设置通知后,它出现在返回的数组中:

UIApplication.getSharedApplication.getScheduledLocalNotifications();

添加后问题解决:

notification.setTimeZone(NSTimeZone.getLocalTimeZone());

并将我的测试计时器的到期时间从 1 分钟设置为 5 分钟 我不确定哪个才是真正的解决方案,但问题已经解决了,所以我很高兴!

编辑:

UILocalNotification notification = new UILocalNotification();
notification.setAlertTitle("title");
notification.setAlertBody("text");

NSMutableDictionary<NSObject, NSObject> dict = new NSMutableDictionary<>();
//add any customer stuff to your dictionary here
notification.setUserInfo(dict);
notification.setFireDate(new NSDate(date));         //date is some date in the future. Make sure it is in the correct TZ. If it does not work, try to make it at least 5 minutes in the future. I remember this helping my situation
notification.setTimeZone(NSTimeZone.getLocalTimeZone());
UIApplication.getSharedApplication().scheduleLocalNotification(notification);