最近在接信鴿推送SDK,官方Demo運行直接崩潰。。。
報錯信息:
dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications
Referenced from: /Users/pengjiaxin/Library/Developer/CoreSimulator/Devices/B6F10A28-530D-44BA-8F3A-87B551132FE2/data/Containers/Bundle/Application/8C29BAE6-6706-4BF8-AEA3-2CDD8DE10E86/XG-Demo.app/XG-Demo
Reason: image not found
(lldb)
原因分析:
從報錯信息上面可以看到是 UserNotifications.framework image not found ,因爲這個UserNotifications.framework在iOS10以下的版本是不可以用的,只能在iOS10及以上版本可以用,到此問題找到。
解決方法:
TARGETS -->Build Phases -->Link Binary With Libraries -->UserNotifications.framework 然後把status由Required改爲Optional,然後在運行,就ok。