{ "id": "162832", "key": "AC-4394", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2016-08-26T14:59:27.000+0000", "created": "2016-08-26T01:40:03.000+0000", "labels": [ "blocks", "callback", "hyperloop" ], "versions": [ { "id": "17038", "name": "Appcelerator Studio 4.5.0", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-08-26T14:59:27.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "15000", "name": "Hyperloop" }, { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Trying to use the Firebase SDK here.\r\nOne of the methods that i'm invoking accepts a callback block. That block is supposed to receive a few parameters.\r\nIf i build my project and try to invoke that method, my callback function never receives any parameters back from \"native side\".\r\n\r\n*Why is it happening:*\r\nSeems 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/.../.../*)\r\n\r\n{code:java}\r\n+ (id) Block_void_____FIRUser____NSError___:(KrollCallback *) callback {\r\n return [^(FIRUser * arg0, NSError * arg1) {\r\n void(^Callback)(void) = ^{\r\n NSArray *args = nil;\r\n id _arg0 = (arg0 == nil || [(id)arg0 isEqual:[NSNull null]]) ? (id)[NSNull null] : (id)[HyperloopPointer pointer:(__bridge void *)arg0 encoding:@encode(id)];\r\n id _arg1 = (arg1 == nil || [(id)arg1 isEqual:[NSNull null]]) ? (id)[NSNull null] : (id)[HyperloopPointer pointer:(__bridge void *)arg1 encoding:@encode(id)];\r\n args = @[_arg0, _arg1];\r\n [HyperloopUtils invokeCallback:callback args:nil thisObject:callback];\r\n };\r\n if ([NSThread isMainThread]) {\r\n Callback();\r\n } else {\r\n dispatch_async(dispatch_get_main_queue(), Callback);\r\n }\r\n } copy];\r\n}\r\n{code}\r\n\r\nThis line:\r\n\r\n{code:java}\r\n[HyperloopUtils invokeCallback:callback args:nil thisObject:callback];\r\n{code}\r\n\r\nis supposed to be like this:\r\n\r\n{code:java}\r\n[HyperloopUtils invokeCallback:callback args:args thisObject:callback];\r\n{code}\r\n\r\nLike 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.\r\n\r\n\r\n\r\n", "attachment": [], "flagged": false, "summary": "Hyperloop iOS - Converted blocks are always returning nil", "creator": { "name": "rdperottoni", "key": "rdperottoni", "displayName": "Rodolfo Perottoni", "active": true, "timeZone": "Australia/Brisbane" }, "subtasks": [], "reporter": { "name": "rdperottoni", "key": "rdperottoni", "displayName": "Rodolfo Perottoni", "active": true, "timeZone": "Australia/Brisbane" }, "environment": "HyperLoop 1.2.6\r\nSDK 5.5.0.v20160821213142", "comment": { "comments": [ { "id": "394450", "author": { "name": "xicovarisco_orange", "key": "xicovarisco_orange", "displayName": "Francisco Ruaro Varisco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Just as a proof, on our Firebase module the usual return of the callback function (createUserWithEmail) is:\r\n\r\n[INFO] User = null\r\n[INFO] error = null\r\n\r\n\r\nWhile the return after changing the '.m' file generated is:\r\n\r\n[INFO] User = null\r\n[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}\r\n", "updateAuthor": { "name": "xicovarisco_orange", "key": "xicovarisco_orange", "displayName": "Francisco Ruaro Varisco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-08-26T01:50:42.000+0000", "updated": "2016-08-26T01:51:07.000+0000" }, { "id": "394496", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-26T14:59:27.000+0000", "updated": "2016-08-26T14:59:27.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }