将 ANE(我自己构建的)添加到 Flex 移动项目时遇到问题。
问题是对象的大小与我添加 ANE 之前不同。我从来没有使用过这个ANE,我只是添加了它。
这是我添加 ANE 之前的图像:
添加 ANE 后的图像:
如您所见,整个应用程序的大小是不同的。你知道哪个可能是问题吗?
提前致谢
**更新信息**
ios上的代码:
#import "FlashRuntimeExtensions.h"
FREContext eventContext;
FREObject init(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[])
{
eventContext = ctx;
NSLog(@"init");
return NULL;
}
void CameraExtContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet)
{
NSLog(@"camera ext context initializer");
*numFunctionsToTest = 1;
FRENamedFunction* func = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * *numFunctionsToTest);
func[0].name = (const uint8_t*) "init";
func[0].functionData = NULL;
func[0].function = &init;
*functionsToSet = func;
}
void CameraExtensionUniversalInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet)
{
NSLog(@"Camera extension initializer");
*extDataToSet = NULL;
*ctxInitializerToSet = &CameraExtContextInitializer;
}
AS中的库代码:
package com.xxx.Controller
{
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
import flash.events.StatusEvent;
import flash.external.ExtensionContext;
public class ReaderDeviceExtensionController extends EventDispatcher
{
private static var _instance:ReaderDeviceExtensionController;
private var extContext:ExtensionContext;
public function ReaderDeviceExtensionController(enforcer:SingletonEnforcer)
{
super();
extContext = ExtensionContext.createExtensionContext( "com.xxx.Controller", "" );
if ( !extContext ) {
throw new Error( "Reader device native extension is not supported on this platform." );
}
}
public static function get instance():ReaderDeviceExtensionController {
if ( !_instance ) {
_instance = new ReaderDeviceExtensionController( new SingletonEnforcer() );
_instance.init();
}
return _instance;
}
public function dispose():void {
extContext.dispose();
}
private function init():void {
extContext.call( "init" );
}
}
}
class SingletonEnforcer {
}
扩展名.xml:
<extension xmlns="http://ns.adobe.com/air/extension/3.1">
<id>com.xxx.Controller</id>
<versionNumber>0.0.1</versionNumber>
<platforms>
<platform name="iPhone-ARM">
<applicationDeployment>
<nativeLibrary>libTestSimpleAne.a</nativeLibrary>
<initializer>CameraExtensionUniversalInitializer</initializer>
</applicationDeployment>
</platform>
</platforms>
</extension>
我使用以下 ADT 命令构建 ANE:
adt -package -target ane MWCameraNativeExtension.ane extension.xml -swc NativeDevicePluginForCamera.swc -platform iPhone-ARM -C ios .
我在 Flex 中的应用程序代码:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="HTMLMainContent">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Label x="346" y="290" fontSize="16" paddingLeft="20" text="HI HI HI"/>
</s:View>