Defold Extension IOS

Hello! I am currently creating a native extension for iOS and i got the error with linking 3rd party frameworks
I added MyLib.framework to /lib/armv64-ios/ and /lib/armv7-ios
I have extension.cpp, extension_private.h and extension_ios.mm files in /src/
I added header to extension_ios.mm #include “MyLib.h” (the header from framework i need)
also i added headers from framework to /include/
But i am getting the following error
Undefined symbols for architecture arm64: "_OBJC_CLASS_$_MyLib", referenced from: objc-class-ref in lib5831e9dc-7360-4668-8ddf-fa699e8dff0c.a(extension_ios.mm_1.o) ld: symbol(s) not found for architecture arm64

My ext.manifest has -ObjC in linkFlags so that is not a problem
I assume that MyLib.framework is not linked with my project, how can i do that?

4 Likes

Hi @renatova.ivan!

The path libs/armv64-ios, is wrong. The name should be libs/arm64-ios (See the list here)

Some notes:

  • A framework can hold multiple architectures: i.e. arm64 and armv7, so you should be able to put it in /libs/ios (if it does indeed contain the relevant architectures)

  • A framework’s includes are automatically picked up, so you shouldn’t need to extract those includes into your own folder.

  • The frameworks/libs are automatically added to the command line, you don’t need to add them yourself.

8 Likes

Thanks a lot, i renamed to /ios/ and it worked perfectly :slight_smile:

5 Likes

Yay, nice! What kind of extension are you creating?

The extension for ads, and i have one more question, what is the max size of 3rd party framework?

2 Likes

Currently, the total payload for all extension data (source, headers, libs, frameworks etc) for the actual platform, is 500mb. A good idea is to strip unneeded architectures from the libraries, since that might take the size down significantly (and it will increase build times)

2 Likes