I'm creating a custom Objective-C framework (dynamic library) and attempting to pull it into a consumer application using Cocoapods. If I don't add the framework as an embedded binary, I get a nasty runtime error:
dyld: Library not loaded: @rpath/MyFramework.framework/MyFramework
Referenced from: /private/var/mobile/Containers/Bundle/Application/XXX/MyFramework.app/MyFramework
Reason: image not found
My understanding is that as a 3rd party custom framework, I have to add it as an embedded binary (due to Apple's concerns about dynamically linking random frameworks). Is that right?
If not, can I change my framework or Podspec file somehow so I don't need to embed it (without making it a static library)?
Otherwise, is there a way to automate adding the framework to embedded binaries on pod install?
By default, cocoapods tries to link pods as static libraries. You can force cocoapods to use frameworks instead by adding use_frameworks! in your Podfile. Or you can probably try to set appropriately
xcconfigor/andvendored_frameworkin your library podspec file to link with your framework. I've seen a good example in Sparkle project's podspec file. Sparkle uses avendored_frameworkworkaround to get dynamic linking working in OSX (i believe because of this issue in cocoapods repo).