RealmSwift(0.92.3)和配置文件错误

时间:2015-05-15 23:32:05

标签: ios swift realm

当我尝试使用我的iPhone设备运行我的watchkit应用程序时出现以下错误消息(即模拟器运行正常):

dyld: Library not loaded: @rpath/RealmSwift.framework/Frameworks/Realm.framework/Realm
  Referenced from: /private/var/mobile/Containers/Bundle/Application/9CCC-B93-89-4E6/MyApp.app/MyApp

Reason: no suitable image found.  Did find:
        /private/var/mobile/Containers/Bundle/Application/9CC8D-43AE7-F8E/MyApp.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm:

code signature invalid for '/private/var/mobile/Containers/Bundle/Application/9C98D-435D-A8E6/MyApp.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm'
(lldb) 

知道该做什么???任何帮助表示赞赏!

2 个答案:

答案 0 :(得分:3)

解决方案是在应用目标中创建一个新的“运行脚本阶段”,如realm.io页面中所述:

"If using Realm in an iOS project, create a new “Run Script Phase” in your
app’s target’s “Build Phases” and paste the following snippet in the script
text field:

bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework/strip-frameworks.sh"

This step is required to work around an App Store submission bug when
archiving universal binaries."

以下是有关如何在Xcode菜单中查找以及最终如何查找的截图!

enter image description here

enter image description here

答案 1 :(得分:0)

Kruherson建议您使用CocoaPods。 Check this post...

感谢Kruherson - 我们现在知道,应用商店中的app-revision期间似乎存在问题,其中包含官方realm.io Swift-documentation页面提供的当前解决方案!

这是CocoaPods安装的说明

Install CocoaPods 0.37.1 or later ([sudo] gem install cocoapods).
In your Podfile, add use_frameworks! and pod 'RealmSwift' to your main and test targets.
From the command line, run pod install.
Use the .xcworkspace file generated by CocoaPods to work on your project!