I’m trying to create a native extension for iOS and use that extension as part of an IPA app for iOS I create from a SWF file using the ADT tool (i.e. the normal use-case for iOS). Note: I have already successfully created the native extension and APK app for Android and now I am trying to build the iOS side.
I have been primarily using the information found at the following websites:
http://www.adobe.com/devnet/air/articles/building-ane-ios-android-pt3.html
http://www.adobe.com/devnet/air/articles/building-ane-ios-android-pt5.html
http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac35eb7b4e12cddc5fbbb-8000.html
I have also searched the Adobe forums for the answer to my question without success.
The error I receive is:
ld: warning: ignoring file /var/folders/c3/mpg4frwn2j1f8scw4jctbmv9hfkswj/T/bd3fbd4a-cf56-4fd6-a06d-d69ea92dc620/lib com.mycompany.MyExtension.a, file was built for archive which is not the architecture being linked (armv7): /var/folders/c3/mpg4frwn2j1f8scw4jctbmv9hfkswj/T/bd3fbd4a-cf56-4fd6-a06d-d69ea92dc620/lib com.mycompany.MyExtension.a
Undefined symbols for architecture armv7:
"_MyExtensionInitializer", referenced from:
_g_com_adobe_air_fre_fmap in aotInfo.o
"_MyExtensionFinalizer", referenced from:
_g_com_adobe_air_fre_fmap in aotInfo.o
ld: symbol(s) not found for architecture armv7
Compilation failed while executing : ld64
I receive the above error when I execute the following command:
adt -package -target ipa-ad-hoc -storetype pkcs12 -keystore certificate.pfx -provisioning-profile provisioning_profile.mobileprovision MyApp.ipa MyApp.xml MyApp.swf -extdir packaged-extensions
where the folder “packaged-extensions” contains the ANE file I created using this command:
adt -package -target ane packaged-extensions/MyExtension.ane MyExtension.xml -swc MyExtension.swc -platform Android-ARM -platformoptions platformAndroidARM.xml -C dependencies . -C platform/Android . -platform iPhone-ARM -platformoptions platformiOSARM.xml -C platform/IOS . -platform default -C platform/default library.swf
where the content of the files are as follows:
MyApp.xml:
<application xmlns="http://ns.adobe.com/air/application/4.0">
<id>MyApp</id>
<versionNumber>0.0.1</versionNumber>
<filename>MyApp</filename>
<initialWindow>
<content>MyApp.swf</content>
<visible>true</visible>
<width>600</width>
<height>600</height>
</initialWindow>
<supportedProfiles>mobileDevice</supportedProfiles>
<extensions>
<extensionID>com.mycompany.MyExtension</extensionID>
</extensions>
</application>
MyExtension.xml:
<extension xmlns="http://ns.adobe.com/air/extension/4.0">
<id>com.mycompany.MyExtension</id>
<versionNumber>0.0.1</versionNumber>
<platforms>
<platform name="Android-ARM">
<applicationDeployment>
<nativeLibrary>MyExtension.jar</nativeLibrary>
<initializer>com.mycompany.MyExtension</initializer>
</applicationDeployment>
</platform>
<platform name="iPhone-ARM">
<applicationDeployment>
<nativeLibrary>libMyExtensionIOSLibrary.a</nativeLibrary>
<initializer>MyExtensionInitializer</initializer>
<finalizer>MyExtensionFinalizer</finalizer>
</applicationDeployment>
</platform>
<platform name="default">
<applicationDeployment/>
</platform>
</platforms>
</extension>
platformiOSARM.xml:
<platform xmlns="http://ns.adobe.com/air/extension/4.0">
<linkerOptions>
<option>-ios_version_min 5.1</option>
<option>-liconv</option>
</linkerOptions>
</platform>
MyExtensionIOSLibrary.m (yes, I know it doesn't do anything - it's simple on purpose to help isolate the error):
#import "FlashRuntimeExtensions.h"
void MyContextInitializer(void* extData, constuint8_t *ctxType, FREContext ctx, uint32_t *numFunctionsToTest, constFRENamedFunction **functionsToSet) {
return;
}
void MyExtensionInitializer(void **extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet) {
*extDataToSet = NULL;
*ctxInitializerToSet = &MyContextInitializer;
}
void MyExtensionFinalizer(void *extData)
{
return;
}
I am using XCode to build MyExtensionIOSLibrary.m into a library file with a .a filename extension. My relevant build settings are:
iOS Deployment Target: iOS 5.1
Architectures: armv7
Build Active Architectures Only: No
Product Scheme: Release
Compile Sources As: Objective-C
Any ideas? Please help.