[英]Robovm : registering for push notification on IOS7 & IOS8
我正在嘗試使用我自己的簡單綁定PushManager在robovm.0.0.14上注冊推送通知,如下所示:
#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 _ $ _ UIUserNotificationSettings
引用自:/ var / mobile / Applications / 6C45E5E5- /var/mobile/Applications/6C45E5E5-AF8F-43E8-9680-5CD3076DB1FF/Game.app/Game AF8F-43E8-9680-5CD3076DB1FF / Game.app / Game
我知道iOS 8 UIUserNotificationSettings
類,但是如何在iOS 7上忽略綁定PushManager類呢?
是否有針對此iOS版本特定問題的解決方法或修復程序?
我檢查是否存在UIUserNotificationSettings
類,該類相關,並且僅可用於iOS 8。
NSClassFromString(@"UIUserNotificationSettings")
這有點間接,但是對我有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.