真机调试问题dyld: Library not loaded

问题说明: 项目在模拟器上运行没有问题, 真机调试时报错, 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

然而错误描述看不出个所以然, 接着便去查阅相关资料.

github 相关问题描述

[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中可能修改了某些权限, 让未付费的账号无法进行真机调试.
尝试把账号切换成公司的付费开发者账号后果然项目可以正常运行了.
移除use_frameworks!这个方法在我的项目中无法适用. 将所有frameworks链接成静态库的方法在绝大多数的情况下应该都是无法适用的.

至此问题解决.

你可能感兴趣的:(真机调试问题dyld: Library not loaded)