在将Swift类添加到旧的Xcode项目后,我得到这个错误。
dyld:库未加载:@rpath/libswift_stdlib_core.dylib
我怎样才能使项目再次运行?
在将Swift类添加到旧的Xcode项目后,我得到这个错误。
dyld:库未加载:@rpath/libswift_stdlib_core.dylib
我怎样才能使项目再次运行?
当前回答
我在我的项目中添加了SCLAlertView pod,后来删除了它。我没有从我的视图控制器中删除导入SCLAlertView。理想情况下,它应该给出一个编译时错误,但它给出了一个运行时错误,提到dyld: Library not loaded: @rpath/SCLAlertView.framework。我从我的视图控制器中删除了导入SCLAlertView,构建它,它没有给出错误。所以在我的情况下,我试图导入一个没有找到框架的库。删除这些引用将解决您的问题。
其他回答
如果以上所有方法都对你没有帮助,你真的很沮丧……尝试所有最好的技巧:清洁和清洁构建文件夹。:)希望它能帮助到一些人!
我使用Xcode 6.1.1版本的Mavericks,在带有iOS 8.1.1的iPhone5上测试,也遇到了同样的问题。我尝试了所有可能的解决方案,包括新的证书和配置配置文件,但都没有帮助。我在项目级和目标级上对包含Swift代码的嵌入式内容和跑道搜索路径进行了更改。
我现在已经安装了优胜美地,没有任何进一步的改变,它开始工作了。
添加框架为“嵌入式二进制文件”,而不仅仅是“链接框架和库”-修正了我的问题。
我还设置嵌入内容包含Swift代码标志为YES。
发生这种情况的原因有很多。刚刚度过了一个有趣的周末,发现了另一个导致这个问题的问题(代码签名的顺序),我想创建一个总结答案,将所有可能的解决方案放在一起:
Add Embedded Content Contains Swift Code to project. You need to set this flag if your app contains Swift code. Clean project. In addition to a Project > Clean you can also delete the DerivedData and Build directories. Look under the Preferences for the location of DerivedData. Build should be in your project folder. Ensure Runpath Search Paths contains @executable_path/Frameworks. Ensure that your certificate contains your Apple Team ID in the OU (Organization Unit) field Apple will add this for you, just revoke your existing distribution certificate and create a new one, download, install on KeyChain, regenerate all provisioning profiles, download those and rebuild. Xcode restart. If everything is basically good, but Xcode hasn't gotten there yet.
这很简单。如果你正在进行自己的命令行构建,你可能会创建自己的.ipa文件来上传。在这种情况下,您需要确保以下内容:
Make sure the version of the Swift files in SwiftSupport/iphoneos is the same as the version in Contents/YourApp.app/Frameworks Because Swift is not yet binary compatible between version, you must ensure these versions are the one that you built your app with. You can find these libraries under /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos. Sign the libraries and frameworks first. You need to codesign the libraries and framework files (under Frameworks in the .app folder) first and then sign the entire .app tree. The .app tree must be signed with an entitlements.plist but not the frameworks.
希望当Swift 3.0问世时,我们不再需要将Swift捆绑到我们的应用程序中,这个问题就会消失。
我试了上面给出的所有答案,都没用。
终于工作后更新到优胜美地