* 请注意,这个问题不是如何在 swift 中注册远程通知,我的问题是如何在运行 iOS8 和 iOS7 的设备上运行时快速编写代码。我发布的代码曾经使用 Xcode beta 1 到 5 执行此操作,但使用 beta 6 现在会生成链接器错误。所以我的问题是如何改变事情来解决 beta 6 中的新链接器错误。*
Xcode Beta 6 出现以下链接错误
Undefined symbols for architecture arm64:
"__TFSsoi1oUSs17_RawOptionSetType_USs21BitwiseOperationsTypeSs9Equatable__FTQ_Q__Q_", referenced from:
__TFC12My_cWireless11AppDelegate29registerForRemoteNotificationfS0_FT_T_ in AppDelegate.o
对于以下用于在 Beta 1 到 5 上编译/链接/执行没有问题的代码。
func registerForRemoteNotification()
{
let registerForRemoteNotificationsMethodExists = UIApplication.sharedApplication().respondsToSelector(Selector("registerForRemoteNotifications"))
if registerForRemoteNotificationsMethodExists
{
UIApplication.sharedApplication()?.registerForRemoteNotifications()
}
else
{
// Fall back to using iOS7 as the code is not running on an iOS 8 device
UIApplication.sharedApplication()?.registerForRemoteNotificationTypes(UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound | UIRemoteNotificationType.Alert)
}
}
为什么它停止与最新的 Beta 版链接?Xcode Beta 6 显示的代码有问题吗?