gpt4 book ai didi

尝试将设备注册到 Bluemix 上的 IBM Mobile First Push 服务时,iOS 应用程序崩溃

转载 作者:行者123 更新时间:2023-11-28 21:38:34 26 4
gpt4 key购买 nike

我有一个在 iPad mini 4 (iOS 9.0.2) 上运行的 iOS 9 应用程序。尝试将设备注册到我在 Bluemix 上的 IMFPush 服务实例时崩溃。

这是在我的 App delegate 中执行注册的代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Push notifications
let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Badge, UIUserNotificationType.Alert, UIUserNotificationType.Sound]
let notificationSettings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
application.registerUserNotificationSettings(notificationSettings)
application.registerForRemoteNotifications()
return true
}

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
// Initialize the Mobile First SDK with IBM Bluemix GUID and route
IMFClient.sharedInstance().initializeWithBackendRoute(MY_APP_ROUTE_HERE, backendGUID: MY_BACKEND_GUID_HERE)
let push = IMFPushClient.sharedInstance()
print("-> Register device token to Mobile First Push for iOS8 Service \(IMFPush.version())");
push.registerDeviceToken(deviceToken, completionHandler: { (response, error) -> Void in
if error != nil {
print("-> Error during device registration to Mobile First Push for iOS8 Service \(error.description)")
}
else {
print("-> Response after device registration (json): \(response.responseJson.description)")
}
})
}

这是运行应用程序时的控制台输出(启动时崩溃):

-> Register device token to Mobile First Push for iOS8 Service 1.0
2015-10-07 09:53:52.895 greenwell[578:152833] [INFO] [IMFPushClient] -[IMFPushClient registerDeviceToken:completionHandler:] in IMFPushClient.m:70 :: Verifying previous device registration.
2015-10-07 09:53:52.900 greenwell[578:152833] [WARN] [IMF] -[IMFAuthorizationManager cachedAuthorizationHeader] in IMFAuthorizationManager.m:447 :: There is no cached authorization header, use obtainAuthorizationHeaderWithCompletionHandler to get the header
2015-10-07 09:53:52.969 greenwell[578:152833] +[IMFResponse responseWithWLResponse:]: unrecognized selector sent to class 0x100113b48
2015-10-07 09:53:52.969 greenwell[578:152833] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[IMFResponse responseWithWLResponse:]: unrecognized selector sent to class 0x100113b48'
*** First throw call stack:
(0x185e98f5c 0x19a897f80 0x185e9fb64 0x185e9cc14 0x185da0dcc 0x10009c088 0x100093648 0x1000923fc 0x100099cb4 0x101315d70 0x101315d30 0x10131b780 0x185e50258 0x185e4e0c0 0x185d7cdc0 0x190d10088 0x18b456f44 0x10004d744 0x19b0b68b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

知道这个问题以及如何解决吗?感谢您的帮助...

最佳答案

确保您的客户端应用程序是使用 -Objcflags编译的。

此设置可以添加到目标的Build Settings>Linking>Other Linker Flags 部分下。

双击现有设置并单击+ 符号。然后在文本字段中添加“-ObjC”。这可以针对调试和发布设置来完成。

有关此设置的更多信息,请参阅 Apple 的问答环节 Building Objective-C static libraries with categories

关于尝试将设备注册到 Bluemix 上的 IBM Mobile First Push 服务时,iOS 应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32987182/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com