AIR application with Native application crash on iOS because of numFunctionsToTest
I wrote a simple Hello World AIR Native Extension and have implemented following context initializer
void helloWorldContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx,
uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet)
{
NSLog(@"Entering ContextInitializer");
*functionsToSet = _methods;
NSLog(@"Method list initialized");
if(numFunctionsToTest != NULL)
{
NSLog(@"numFunctionToTest is not null");
*numFunctionsToTest = (uint32_t)2;
}
NSLog(@"Exiting ContextInitializer");
}
My Application crash on iOS device with following message in console.
Dec 29 15:58:41 unknown HelloWorld[24298] <Warning>: Entering ContextInitializer
Dec 29 15:58:41 unknown HelloWorld[24298] <Warning>: Method list initialized
Dec 29 15:58:41 unknown HelloWorld[24298] <Warning>: numFunctionToTest is not null
Dec 29 15:58:42 unknown ReportCrash[24302] <Notice>: Formulating crash report for process HelloWorld[24298]
Dec 29 15:58:42 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:org.divy.contactmanagement[0x5c0]) Job appears to have crashed: Bus error: 10
Dec 29 15:58:42 unknown SpringBoard[15] <Warning>: Application 'HelloWorld' exited abnormally with signal 10: Bus error: 10
Dec 29 15:58:43 unknown ReportCrash[24302] <Error>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/
It seems line following line is cause of the problem.
*numFunctionsToTest = (uint32_t)2;
modified the line to *numFunctionsToTest = 2; still no luck.
It seem the pointer is pointing is not correct.
Following is the Device log if it helps.
Incident Identifier: 650833B2-9F2E-4186-B499-29C9088EBD66
CrashReporter Key: f559e8609ce49e196f1137a3c1c7d27b40377472
Hardware Model: iPhone3,1
Process: HelloWorld [24065]
Path: /var/mobile/Applications/35BEA219-A5DF-48BB-8602-228EB8AF3D61/HelloWorld.app/HelloWorld
Identifier: HelloWorld
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2011-12-29 14:36:08.226 -0800
OS Version: iPhone OS 5.0.1 (9A405)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x011c6d85
Crashed Thread: 0
