dyld Symbol not found

Hi there,


I recently inherited a project which is set up as follows -


Framework A - written in Objective-C, includes a third party framework written in Swift


My app, written in Objective C, includes Framework A via a CocoaPod.


When I attempt to run the app I get the following error -


dyld: Symbol not found: __TMaCs29_NativeDictionaryStorageOwner


Referenced from: /private/var/containers/Bundle/Application/0020678D-C59B-4299-938D-070508CC6F19/Auth (DEV).app/Frameworks/ZoomAuthentication.framework/ZoomAuthentication

Expected in: /private/var/containers/Bundle/Application/0020678D-C59B-4299-938D-070508CC6F19/Auth (DEV).app/Frameworks/libswiftCore.dylib

in /private/var/containers/Bundle/Application/0020678D-C59B-4299-938D-070508CC6F19/Auth (DEV).app/Frameworks/ZoomAuthentication.framework/ZoomAuthentication


Initially, I thought this was a Swift Version issue, however, the third party framework has recently been updated for the latest version of Swift (3.1). I'm using Xcode 8.3 which supports Swift 3.1 also.


The Build Settings in my app specify SWIFT_VERSION as 3.1.


When I build the app, and look in the Package Contents, I see that there are two copies of the third party framework copied - one in the app's Frameworks directory (which also includes all the Swift Runtime, libswiftCore.dylib etc..), and one in Framework A's directory.


I think the third party framework is looking for the Swift Runtime and cant find it, because it's looking in Framework A's directory, which doesnt have the Swift runtime in there - it is up one level. I *think* that is what is happening.


- App

- Frameworks

- Framework A

- Third Party framework

- Third Party framework

- Swift runtime


So I'm wondering if this sounds feasible? and if so, can Framework A be configured somehow to allow the third party framework to find Swift in its parents directory?


Thanks for any assistance.


Best regards,

David

Judging by the paths you posted I’m assuming you’re building for iOS. If so, you definitely have framework structure problems. iOS does not supported nested frameworks, so your final structure will have to look like this:

Your.app/
    …
    Frameworks/
        … Swift libraries …
        FrameworkA.framework/
            …
        ThirdParty.framework/
            …

and then you’ll have to make sure that the various linker references are right.

Are you building both

FrameworkA
and
ThirdParty.framework
from source?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi Eskimo,


Thanks for your reply. Yes I am building for iOS..


Framework A is imported to the app Project via a cocoapod, includes all the source (headers and implementation files), and builds the framework from source. The Third Party framework is prebuilt..


I think, like you say, its linker settings in the app Build Settings, and possibly in Framework A Build Settings.. The thing is there are many 'search paths' etc.. to configure, it's knowing which one is the right one without breaking anything else.. Fiddly business! 🙂 I'll have to dig around a bit ..


Thanks again for your reply..

David

I have decided to not go the route of using a nested framework.


Instead, in my Framework, I import the 3rd Party Framework to the project, use its functionality, but dont add it to the 'Linked Libraries and Frameworks' section. This builds fine, but doesnt include the 3rd Party Framework in the framework directory / bundle. In the app project, I then add the Framework, and the 3rd Party Framework directly to the app project via 'Embedded Binaries'. This builds and deploys to device with no errors.


In Framework -


Always Embed Swift Standard Libraries:

No


Framework Search Paths:

$(inherited)

$(PROJECT_DIR)

$(PROJECT_DIR)/<MyFramework>


Runpath Search Paths:

$(inherited)

@executable_path

@loader_path/Frameworks

@executable_path/Frameworks


Installation Directory:

$(LOCAL_LIBRARY_DIR)/Frameworks


Dynamic Library Install Name:

$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)


Dynamic Library Install Name Base:

@rpath


Mach-O Type:

Dynamic Library


Build Active Architecture Only:

No



In App -


Always Embed Swift Standard Libraries:

Yes


Framework Search Paths:

$(PROJECT_DIR)

$(PROJECT_DIR)/<MyApp>


Runpath Search Paths:

$(inherited)

@executable_path/Frameworks


Installation Directory:

$(LOCAL_APPS_DIR)



That did the trick for me...

dyld Symbol not found
 
 
Q