I'm having a problem running my Realm-based Swift app on actual hardware. I keep getting "dyld: Library not loaded: @rpath/Realm.framework/Realm" when the app starts then leads to a SIGABRT dyld`__abort_with_payload. The app runs fine on the simulator. I've followed the steps on the Realm Swift website, dragged frameworks into embedded frameworks, added build phase script, added framework path to unit test target. I'm kind of at a loss here. I'm using xcode 9, iPhone 7 iOS 11.
0
votes
The dyld abort message includes more information about why the library couldn’t be loaded. That’ll tell you whether it’s missing entirely, or built for the wrong architecture, etc.
– bdash
What's interesting is that I removed and re-added the Realm frameworks to my project and now I get the error "Bash: /User/<me>/Library/Developer/Xcode/DerivedData/<app name with long hash>/Build/Products/Debug-iphonesimulator/<app name>.app/Framework/Realm.framework/strip-framework.sh: No such file or directory." I've cleaned project, deleted DerivedData dir, restarted laptop, etc. I'm not sure why it can't find the framework. I took all the steps on the website.
– u84six
Still works in the simulator though.
– u84six
Could it be that the frameworks aren't getting signed or something like that? Whenever I have problems like this, it always leads to cert problems, but I'm not sure where to start to fix this problem.
– u84six
take a look at my answer on similar question stackoverflow.com/questions/48917407/…
– Evgeny Karkan
3 Answers
2
votes
Here's what fixed my problem:
- Log out of xcode Preferences->Account
- Open keychain app on mac and delete all iOS dev certificates.
- Restart mac.
- Open xcode and and log back in with Apple ID Preferences->Account
- Go to app Target->General and make sure "Automatically manage signing" is checked and correct team is selected.
- Run the app, and a message will pop up saying that cert not found in keychain (something like that). Just continue and when it warns you that cert needs to be revoked first, select to Revoke.
At this point, the problem is gone and the app is running.
For the issue I mentioned in the comments of op, the fix for that was to click on app target->Build Phases and drag the Run Script to the bottom of the list. It has to run after Embedded Frameworks! This was a side effect from me debugging original problem and removing/adding the realm framework. After doing that, the run script was now second last in the list with embedded frameworks following it.
0
votes