Reproduce
1. If you have following method in custom SDK.
#import <Foundation/Foundation.h>
@interface TestLib : NSObject
// Takes pointer to NSInteger as third argument to store result
+(void)addNumber: (NSInteger)num1 with:(NSInteger)num2 result:(NSInteger*)result;
@end
2. And call it in a app like following
var result = 0;
TestLib.addNumberWithResult(1, 2, result); // throws [NSInvocation setArgument:atIndex:]: NULL address argument error
// TestLib expects a pointer to NSInteger as third argument
alert('Result: ' + result);
3.Then you will get error like following which seems hyperloop do not recognise the pointer to NSIntege or NSUInteger.
-[NSInvocation setArgument:atIndex:]: NULL address argument
[ERROR] : Script Error {
[ERROR] : column = 26;
[ERROR] : description = "-[NSInvocation setArgument:atIndex:]: NULL address argument";
[ERROR] : line = 98;
[ERROR] : message = "-[NSInvocation setArgument:atIndex:]: NULL address argument";
[ERROR] : name = NSInvalidArgumentException;
Note
Note sure is this expected. If yes, please change this to a feature request ticket since customer try to use a RSA SDK, but can't do it because of the above issue.
Hmm. The method uses a pointer to NSInteger as the third parameter, which is unconventional. I think Hyperloop presumes you use the iOS api with objective C in a conventional way. you can't exactly assign a
var result
to a pointer. and so it errors out. It's expected behavior, unless there's someway using nodeJS you give result as a memory address or pointer. [~hansknoechel] thoughts?[~hansknoechel] [~jvennemann] Please update this. Thanks.
[~sliang], as Kiat already mentioned, Javascript doesn't support the concept of pointers like in C-style languages, so what the customer is trying to achieve in his example is not possible. Although Javascript passes objects in a pass-by-reference style there is now way to control that. Primitive values like integers are always passed by value hence invoking a native function which uses a pointer to pass a primitive value back to it's calling context won't work. Please note that this only applies to primitive values. Objects created with Hyperloop proxy classes like
var view = new UIView()
can be modified and those changes will be available in the calling context. To workaround this limitation the customer has make use of return values instead of pointers for primitive values.