You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Realm to an umbrella/parent framework to use as an application target dependency.
This has been a bit of a saga, to be honest. I'll try to keep it brief and not combine any issues, but I think it's worth mentioning.
I've written an XMPP chat framework that uses Realm for persistence. Adding this framework as a linked library was initially leading to a Segmentation Fault 11:
1. While type-checking declaration 0x7fee91020500 at /Users/corey/Development/<projectName>/User.swift:200:1
2. While loading conformances for 'ChatUser' at <invalid loc>
For clarity's sake, ChatUser is a Realm Object subclass. User.swift conforms to a protocol with a method that returns a ChatUser object.
At this point I decided to step back and eliminate as many variables as possible which leads me to where I am now.
Expected Results
Framework is linked, Realm is found, and application compiles.
Actual Results
I can compile ParentFramework itself without issue. After adding the framework project as a subproject, making it an application's Target Dependency, and linking the parent framework, building fails with:
For simulator:
ld: framework not found Realm for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
For a device: ld: framework not found Realm for architecture arm64
FWIW, file <path to Realm.framework binary> produces:
My current workaround:
Now, if I build and link Realm.framework and RealmSwift.framework in the containing project (RealmTestExample) as well, it works fine. But surely that shouldn't be necessary?
Steps to Reproduce
See Linked code sample, but steps were as follows:
Create a new Swift project - single view iOS Application for instance
Add the Realm-supplied ParentFramework project as a subproject. Run carthage update in the Parent Framework directory and modify the sole method in the framework to return a valid string.
ProductName: Mac OS X
ProductVersion: 10.12
BuildVersion: 16A323
/Applications/Xcode.app/Contents/Developer
Xcode 8.2
Build version 8C38
/usr/local/bin/pod
1.0.0
(not in use here)
/bin/bash
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
/usr/local/bin/carthage
0.19.1
(not in use here)
/usr/bin/git
git version 2.10.1 (Apple Git-78)
Realm version: 2.4.2
The text was updated successfully, but these errors were encountered:
cwalo
changed the title
Linking a parent framework containing Realm results in framework not found Realm for architecture x86_64
Linking a parent framework containing Realm results in "framework not found Realm for architecture x86_64"
Feb 20, 2017
cwalo
changed the title
Linking a parent framework containing Realm results in "framework not found Realm for architecture x86_64"
Linking a parent framework containing Realm results in "framework not found Realm for architecture ..."
Feb 20, 2017
In Xcode, the framework search path build setting determines where the linker looks for frameworks at link time. Since your app target attempts to link to RealmSwift.framework (as a result of importing ParentFramework), RealmSwift.framework needs to be available on the framework search path.
It's important to note that while nested frameworks work in the iOS simulator and even locally on your device, iTunes Connect rejects app bundles that contain nested frameworks. The expected pattern is that all frameworks are embedded directly within the app.
Goals
Add Realm to an umbrella/parent framework to use as an application target dependency.
This has been a bit of a saga, to be honest. I'll try to keep it brief and not combine any issues, but I think it's worth mentioning.
I've written an XMPP chat framework that uses Realm for persistence. Adding this framework as a linked library was initially leading to a Segmentation Fault 11:
For clarity's sake,
ChatUser
is a RealmObject
subclass.User.swift
conforms to a protocol with a method that returns aChatUser
object.At this point I decided to step back and eliminate as many variables as possible which leads me to where I am now.
Expected Results
Framework is linked, Realm is found, and application compiles.
Actual Results
I can compile
ParentFramework
itself without issue. After adding the framework project as a subproject, making it an application's Target Dependency, and linking the parent framework, building fails with:For simulator:
For a device:
ld: framework not found Realm for architecture arm64
FWIW,
file <path to Realm.framework binary>
produces:My current workaround:
Now, if I build and link Realm.framework and RealmSwift.framework in the containing project (RealmTestExample) as well, it works fine. But surely that shouldn't be necessary?
Steps to Reproduce
See Linked code sample, but steps were as follows:
carthage update
in the Parent Framework directory and modify the sole method in the framework to return a valid string.ParentFramework
as a Target dependency.ParentFramework
libraryimport ParentFramework
to AppDelegateCode Sample
This should be everything you need to reproduce: realm-framework-test
Version of Realm and Tooling
The text was updated successfully, but these errors were encountered: