Skip to main content
Inspiring
April 23, 2012
Question

How do I trace an NSLog to the flash output window from a native extension

  • April 23, 2012
  • 1 reply
  • 1218 views

Debugging an Native Extension for iOS is a pain. Major pain.

What I would like to know is, is there a way I can do the equilant of a trace statement in the object-c code without having to rely on dispatched events.

Basically, I have a function that has an error in it someplace. Not being too super familiar with object-c, I want to be able to "trace" each line as it's executed, so when the app DOES crash (as it will), I can find which line it's actually crashing on and thus fix it.

The following is my only "trace" system for sending messages back to flash:

// note: this was typed in the forums, not copied pasted from code as the code is running on a mac - forgive typos)

void trace(NSString *msg)

{

     NSString *code = @"trace_event";

     FREDispatchStatusEventAsync(context, (uint8_t*)[code UTF8String], (uint8_t*][msg UTF8String]));
     [[NSRunLoop currentRunLoop] runUntilDate:[NSDate date]];

}

Then in my ANE, when it recieves a "trace_event", it simply does a trace(msg).

This works most of the time, not always as the event needs time to possible... and if the function in the extension is crashing out, it doesn't always get to trigger

What I would LIKE to do is be able to pass a function pointer so that my "trace" function in the extension can call the function in the ANE to do the trace without having to rely on an event.

any ideas?

This topic has been closed for replies.

1 reply

Inspiring
April 23, 2012

Ok... upon reading up a little more, I *think* what I need is the "FRECallObjectMethod"

but I can't figure out how to implement it or find any samples. Any thoughts?