Robovm:在IOS7&;上注册推送通知;损失8
我正在尝试使用我自己的简单绑定PushManager在robovm.0.0.14上注册推送通知,如下所示:Robovm:在IOS7&;上注册推送通知;损失8,ios,apple-push-notifications,robovm,Ios,Apple Push Notifications,Robovm,我正在尝试使用我自己的简单绑定PushManager在robovm.0.0.14上注册推送通知,如下所示: #import "PushManager.h" @implementation PushManager -(void) registerForPushNotifications { NSLog(@"Registering for push notifications"); if ([[UIApplication sharedApplication] respondsT
#import "PushManager.h"
@implementation PushManager
-(void) registerForPushNotifications
{
NSLog(@"Registering for push notifications");
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
NSLog(@"Registering for IOS 8 and later");
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
} else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
}
@end
它正在IOS8设备上运行,但应用程序在类链接阶段在IOS 7设备上崩溃,如下所示:
dyld:未找到符号:_OBJC_CLASS_$\u UIUserNotificationSettings引用自: /var/mobile/Applications/6C45E5E5-AF8F-43E8-9680-5CD3076DB1FF/Game.app/Game 预期位于:/System/Library/Frameworks/UIKit.framework/UIKit中 /var/mobile/Applications/6C45E5E5-AF8F-43E8-9680-5CD3076DB1FF/Game.app/Game 我知道iOS 8附带了
UIUserNotificationSettings
类,但我怎么能忽略iOS 7上绑定的PushManager类呢
对于这个iOS版本特定的问题,是否有任何解决方法或修复方法?我检查是否存在类
UIUserNotificationSettings
,它是相关的,并且仅适用于iOS 8
NSClassFromString(@"UIUserNotificationSettings")
这有点间接,但对我有效