Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4394] Hyperloop iOS - Converted blocks are always returning nil

GitHub Issuen/a
Resolution Date2016-08-26T14:59:27.000+0000
Affected Version/sAppcelerator Studio 4.5.0
Fix Version/sn/a
ComponentsHyperloop, Titanium SDK & CLI
Labelsblocks, callback, hyperloop
ReporterRodolfo Perottoni
AssigneeShak Hossain


Trying to use the Firebase SDK here. One of the methods that i'm invoking accepts a callback block. That block is supposed to receive a few parameters. If i build my project and try to invoke that method, my callback function never receives any parameters back from "native side". *Why is it happening:* Seems like HyperLoop is invoking the callback blocks with *nil*, as you can see below. This applies for all the block conversion methods in the generated *.m* files (inside */build/hyperloop/.../.../*)
+ (id) Block_void_____FIRUser____NSError___:(KrollCallback *) callback {
    return [^(FIRUser * arg0, NSError * arg1) {
        void(^Callback)(void) = ^{
            NSArray *args = nil;
            id _arg0 = (arg0 == nil || [(id)arg0 isEqual:[NSNull null]]) ? (id)[NSNull null] : (id)[HyperloopPointer pointer:(__bridge void *)arg0 encoding:@encode(id)];
            id _arg1 = (arg1 == nil || [(id)arg1 isEqual:[NSNull null]]) ? (id)[NSNull null] : (id)[HyperloopPointer pointer:(__bridge void *)arg1 encoding:@encode(id)];
            args = @[_arg0, _arg1];
            [HyperloopUtils invokeCallback:callback args:nil thisObject:callback];
        if ([NSThread isMainThread]) {
        } else {
            dispatch_async(dispatch_get_main_queue(), Callback);
    } copy];
This line:
[HyperloopUtils invokeCallback:callback args:nil thisObject:callback];
is supposed to be like this:
[HyperloopUtils invokeCallback:callback args:args thisObject:callback];
Like i said... this applies for every single block conversion methods in generated *.m* files. There is proof of this in the UIKit.m generated when you build the HyperLoop Examples project.


  1. Francisco Ruaro Varisco 2016-08-26

    Just as a proof, on our Firebase module the usual return of the callback function (createUserWithEmail) is: [INFO] User = null [INFO] error = null While the return after changing the '.m' file generated is: [INFO] User = null [INFO] error = Error Domain=FIRAuthErrorDomain Code=17007 "The email address is already in use by another account." UserInfo={NSLocalizedDescription=The email address is already in use by another account., error_name=ERROR_EMAIL_ALREADY_IN_USE}
  2. Hans Knöchel 2016-08-26

JSON Source