ios - 添加代码以注册用户通知设置时出现错误结果

标签 ios xcode swift

所以我正在尝试使用 Xcode 6 beta 6 和 swift 编码为我的应用程序注册用户通知。下面是我的代码,它会导致下面的两个 apple mach-o 错误。

知道如何解决吗?我在代码中做错了什么吗?

更新: 如果我只留下一种通知类型它工作正常,所以我认为问题是“|”分隔符,正确的方法是什么?我到处都是这样。

func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
    // Override point for customization after application launch.

    application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Badge, categories: nil))

    return true
}

错误:

    Ld /Users/christopherbonilla/Library/Developer/Xcode/DerivedData/---esgnlherkoqgtbczodawinrqohqs/Build/Products/Debug-iphoneos/--.app/-- normal armv7
    cd /Users/christopherbonilla/--/--/--
    export IPHONEOS_DEPLOYMENT_TARGET=8.0
    export PATH="/Applications/Xcode6-Beta6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode6-Beta6.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode6-Beta6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode6-Beta6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk -L/Users/christopherbonilla/Library/Developer/Xcode/DerivedData/---esgnlherkoqgtbczodawinrqohqs/Build/Products/Debug-iphoneos -F/Users/christopherbonilla/Library/Developer/Xcode/DerivedData/---esgnlherkoqgtbczodawinrqohqs/Build/Products/Debug-iphoneos -filelist /Users/christopherbonilla/Library/Developer/Xcode/DerivedData/---esgnlherkoqgtbczodawinrqohqs/Build/Intermediates/--.build/Debug-iphoneos/--.build/Objects-normal/armv7/--.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -ObjC -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration -lswiftCore -L/Applications/Xcode6-Beta6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/christopherbonilla/Library/Developer/Xcode/DerivedData/---esgnlherkoqgtbczodawinrqohqs/Build/Intermediates/--.build/Debug-iphoneos/--.build/Objects-normal/armv7/--.swiftmodule -miphoneos-version-min=8.0 -framework Foundation -framework CoreLocation -framework CoreBluetooth -lPods -Xlinker -dependency_info -Xlinker /Users/christopherbonilla/Library/Developer/Xcode/DerivedData/---esgnlherkoqgtbczodawinrqohqs/Build/Intermediates/--.build/Debug-iphoneos/--.build/Objects-normal/armv7/--_dependency_info.dat -o /Users/christopherbonilla/Library/Developer/Xcode/DerivedData/---esgnlherkoqgtbczodawinrqohqs/Build/Products/Debug-iphoneos/--.app/--

Undefined symbols for architecture armv7:
  "__TFSsoi1oUSs17_RawOptionSetType_USs21BitwiseOperationsTypeSs9Equatable__FTQ_Q__Q_", referenced from:
      __TFC11--11AppDelegate11applicationfS0_FTGSQCSo13UIApplication_29didFinishLaunchingWithOptionsGSQCSo12NSDictionary__Sb in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

最佳答案

只需转到:~/Library/Developer/Xcode/DerivedData 并删除内容。这已经解决了我在 beta 6 中的所有 mach-o 错误。

关于ios - 添加代码以注册用户通知设置时出现错误结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25394245/

相关文章:

swift - 从父类(super class)调用所有子类的函数

ios - 在 SwiftUI 中让 VStack 填满屏幕宽度

xcode - 调用 UIImagePicker ViewController 时状态栏返回?

iphone - ARKit是否考虑iPhone和iPad中的镜头变形?

ios - 在 .plist 文件中使用 .xcconfg 值

objective-c - 为 UITabBar 设置事件图像

Swift - 选定的标签栏索引不触发滚动到顶部

ios - 如何在WKWebView中启用嵌入的YouTube视频?

ios - 如何使用在 NSUserDefaults 中保存值的开关显示/隐藏按钮

ios - 谷歌地图 Swift 2 cocoapods