3
votes

I've created a custom dynamic library (let's call in LogLibrary.framework) in Swift 2.1. No I'd like to link the Realm.framework and RealmSwift.framework with it.

I did follow the installation instructions provided on https://realm.io/docs/swift/latest/.

These steps are:

  • Link Binary with Libraries (Realm.framework and RealmSwift.framework added)
  • Build Phase -> Add copy files Phase -> Destination "Frameworks"
  • Run Script Phase -> bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework/strip-frameworks.sh"

enter image description here

Unfortionally, if l link the LogLibrary.framework in my sample Application, I always get the following compile error:

ld: framework not found Realm for architecture i386

I did not set any additional linker flags in the sample Application.

enter image description here

However, It works if I also link the Realm.framework and RealmSwift.framework in the sample Application - but that's not what I want, because they are already linked within the LogLibrary.framework

Any Ideas how I can get rid of the compile error? Sample Project: https://github.com/sehdich/RealmLinkError.git

1

1 Answers

2
votes

You should link Realm and RealmSwift.framework to PhotoApp target too. Because those frameworks are not static libraries. They are linked dynamically. So they are still specified to link app's target and included in app bundle.

enter image description here