問題說明: 項(xiàng)目在模擬器上運(yùn)行沒有問題, 真機(jī)調(diào)試時(shí)報(bào)錯(cuò), dyld: Library not loaded
issues deatil
dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire
Referenced from: /private/var/containers/Bundle/Application/401D82AD-A04B-4D59-9DB5-BE75E6DCF25D/XiaGuangHW.app/XiaGuangHW
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/401D82AD-A04B-4D59-9DB5-BE75E6DCF25D/XiaGuangHW.app/Frameworks/Alamofire.framework/Alamofire: code signature invalid for '/private/var/containers/Bundle/Application/401D82AD-A04B-4D59-9DB5-BE75E6DCF25D/XiaGuangHW.app/Frameworks/Alamofire.framework/Alamofire'
/private/var/containers/Bundle/Application/401D82AD-A04B-4D59-9DB5-BE75E6DCF25D/XiaGuangHW.app/Frameworks/Alamofire.framework/Alamofire: code signature invalid for '/private/var/containers/Bundle/Application/401D82AD-A04B-4D59-9DB5-BE75E6DCF25D/XiaGuangHW.app/Frameworks/Alamofire.framework/Alamofire'
/private/var/containers/Bundle/Application/401D82AD-A04B-4D59-9DB5-BE75E6DCF25D/XiaGuangHW.app/Frameworks/Alamofire.framework/Alamofire: stat() failed with errno=1
/private/var/containers/Bundle/Application/401D82AD-A04B-4D59-9DB5-BE75E6DCF25D/XiaGuangHW.app/Frameworks/Alamofire.framework/Alamofire: code signature invalid for '/private/var/containers/Bundle/Application/401D82AD-A04B-4D59-9DB5-BE75E6DCF25D/XiaGuangHW.app/Frameworks/Alamofire.framework/Alamofire'
/private/var/containers/Bundle/Application/401D82AD-A04B-4D59-9DB5-BE75E6DCF25D/XiaGuangHW.app/Frameworks/Alamofire.framework/Alamofire: stat() failed with errno=1
然而錯(cuò)誤描述看不出個(gè)所以然, 接著便去查閱相關(guān)資料.
github 相關(guān)問題描述
[https://github.com/Alamofire/Alamofire/issues/3051]
接著看到這一段話
Are you using a non-developer Apple ID to install the app to your phone? It looks like iOS 13.3.1 has broken apps installed with free Apple IDs, but only if they contain embedded frameworks. If it's possible to link all your dependencies as static libraries rather than frameworks (for example, if you're using Cocoapods you can remove use_frameworks! from your Podfile), that should fix the issue for now.
蘋果在最新的iOS13.3.1中可能修改了某些權(quán)限, 讓未付費(fèi)的賬號(hào)無法進(jìn)行真機(jī)調(diào)試.
嘗試把賬號(hào)切換成公司的付費(fèi)開發(fā)者賬號(hào)后果然項(xiàng)目可以正常運(yùn)行了.
移除use_frameworks!
這個(gè)方法在我的項(xiàng)目中無法適用. 將所有frameworks鏈接成靜態(tài)庫的方法在絕大多數(shù)的情況下應(yīng)該都是無法適用的.
至此問題解決.