iOS Question libDev return from raiseEvent

nobbi59

Active Member
Licensed User
Longtime User
Hello,

Im writing a Library right now and Im trying to raise an Event in B4I, then I want to get the return value from this Event.

When I raise the Event, the App crashes and the Log says the following:

Unexpected event (missing RaisesSynchronousEvents): wv_test:::
SignalHandler 11
Error occurred on line: 0 (act_cstm)
Signal - 11

I can't figure out why this is happening. I even set "RaisesSynchronousEvents:true"...

Heres a bit of code of my Library:

B4X:
//~Event:PageFinished (Url As String, Success as Boolean)
//~Event:OverrideUrl (Url As String)
//~Event:function (fname As String, params As String, ret As String)
//~RaisesSynchronousEvents:true

Here Im calling the Event:

B4X:
NSString* evtname = [NSString stringWithFormat: @"%@%@", @"_", param];
    evtname = [NSString stringWithFormat: @"%@%@", evtname, @":::"];
    NSLog([NSString stringWithFormat:@"%@%@",@"CallSub triggered with ", evtname]);
    NSString* ret = [B4IObjectWrapper raiseEvent:self :evtname :@[param2,param3,param4]];
    NSLog(ret);
    return ret;

I hope someone can help me with this issue.
 

nobbi59

Active Member
Licensed User
Longtime User
Don't know if I understand you right @Erel. I put it in the .h file right above the function where I am calling the event:

B4X:
//~RaisesSynchronousEvents:true
- (NSString*) CallSub: (NSString*) param : (NSString*) param2 : (NSString*) param3 : (NSString*) param4;

Contents of the function are the ones mentioned in my 1st post.

Unfortunately its still not working. Throwing the same error.
 
Upvote 0

nobbi59

Active Member
Licensed User
Longtime User
@Erel may it be a problem that the method that raises the Event is triggered through invocation?
 
Upvote 0

nobbi59

Active Member
Licensed User
Longtime User
Yes. Im wrapping a objc Library for a Javascript Interface like the one in android. Everything works fine except returning from b4i to my objc lib.
 
Upvote 0

nobbi59

Active Member
Licensed User
Longtime User
Maybe you should know that the event name is not fix. its a variable set through javascript.
 
Upvote 0

nobbi59

Active Member
Licensed User
Longtime User
Yes understand that but i need to return a value. This is where the error is happening. if i write the code without expecting a return value, everything is fine.
 
Upvote 0

nobbi59

Active Member
Licensed User
Longtime User
Good idea @Erel. I changed my code and now im calling the method with:

B4X:
[interface performSelectorOnMainThread:@selector(CallBISub:) withObject:args waitUntilDone:YES];

But im still getting the same error :(
 
Upvote 0

nobbi59

Active Member
Licensed User
Longtime User
Thanks @Erel, after I was struggling to set up everything in the library for Release mode (armv7 architechture) I found out that its working fine in release mode (seems strange to me).
In debug mode its still crashing with the same error...Maybe im missing some configuration or something like that?
 
Upvote 0

nobbi59

Active Member
Licensed User
Longtime User
Yes, im always checking the thread the library is running on and it always tells me that its the main thread, so issue cannot be the thread.

For me its working now, but before i release the library to the forums, i will make sure its also working in debug mode.
 
Upvote 0
Top