Copy link to clipboard
Copied
I'm trying to add an Objective C class to an existing native extension that I have for iOS. The code builds fine in Xcode, and the ANE process still seems to work fine. But when I try to package the application for debugging on my iPhone I get this error:
Error occurred while packaging the application:
ld: duplicate symbol _OBJC_METACLASS_$_EmailViewDelegate in C:\Users\jmiller\AppData\Local\Temp\18faba99-de69-437b-8fed-c983e5ce2882/libTspNativeExt.a(EmailViewDelegate.o) and C:\Users\jmiller\AppData\Local\Temp\18faba99-de69-437b-8fed-c983e5ce2882/libnet.theservicepro.a(EmailViewDelegate.o) for architecture armv7
Compilation failed while executing : ld64
EmailViewDelegate is the name of the class I'm trying to add. libTspNativeExt.a is the library I'm building in Xcode. I have no idea where libnet.theservicepro.a is coming from but it is based on the id from my extension.xml (which is net.theservicepro). I've inspected the ANE with WinRAR and although I see my libTspNativeExt.a in the iOS folder, I do not see this other library anywhere.
The only fix I'm seeing is to use hideAneLibSymbols=yes in the launch parameters. However, when I do that I get this error while packaging:
Error occurred while packaging the application:
Compilation failed while executing : ld64
Most people are running into this problem with two native extensions that actually conflict. But something in my flow seems to be duplicating the code within my single ANE. Any suggestions?
Copy link to clipboard
Copied
And all it took was typing out the question for the answer to hit me. I'm going to share it here incase anyone else runs into this same problem.
The problem was in my platform_options.xml file for iOS. The previous coder had set it up like this:
<packagedDependencies>
<packagedDependency>libTspNativeExt.a</packagedDependency>
<packagedDependency>BMSPrinterKit_US.framework</packagedDependency>
</packagedDependencies>
So behind the scenes, ADT is putting all these dependancies into a libextensionid.a library which means we were telling it to import our library a second time. I'm amazed it actually worked before!