macOS調(diào)用framework中類別的方法嫩挤,編譯成功害幅,但運(yùn)行報(bào)錯(cuò)。
+[NSString xx_stringIsEmpty:]: unrecognized selector sent to class 0x7fff88456060
更多錯(cuò)誤如下:
+[NSString xx_stringIsEmpty:]: unrecognized selector sent to class 0x7fff88456060
Failed to set (contentViewController) user defined inspected property on (NSWindow): +[NSString xx_stringIsEmpty:]: unrecognized selector sent to class 0x7fff88456060
因?yàn)閷?dǎo)入的Framework中含有類別岂昭,而在調(diào)用類別的方法時(shí)以现,出現(xiàn)錯(cuò)誤。根據(jù)iOS的經(jīng)驗(yàn)约啊,在Taget->Build Settings->Other Linker Flags 中分別嘗試添加-ObjC邑遏,-all_load和-force_load(加路徑),都不能解決上述問題恰矩。
最終在Taget->Build Phases 中新加 New Copy Files Phase记盒,Destination選擇Frameworks,然后添加Framework即可解決上述問題枢里。
導(dǎo)入framework時(shí)出現(xiàn)下列錯(cuò)誤也可以使用該方法解決
dyld: Library not loaded: @rpath/xxx.framework/xxx
Referenced from: /var/mobile/Applications/xxx/xxx.app/xxx
Reason: image not found
操作如下:image.png
image.png
image.png