NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore
http://docs.nativescript.org/runtimes/ios
Apache License 2.0
298 stars 59 forks source link

iOS runtime Marshalling returns NSObject - Objective-C iOS-onfido-sdk #1251

Closed heena-1993 closed 4 years ago

heena-1993 commented 4 years ago

Environment $ tns info ✔ Getting NativeScript components versions information... ⚠ Update available for component nativescript. Your current version is 6.3.1 and the latest available version is 6.3.3. ✔ Component tns-core-modules has 6.3.2 version and is up to date. ✔ Component tns-android has 6.3.1 version and is up to date. ✔ Component tns-ios has 6.3.0 version and is up to date.

$ ng --version Angular CLI: 8.3.22 Node: 10.18.0 OS: darwin x64 Angular: 8.2.14 ... animations, common, compiler, compiler-cli, core, forms ... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.803.22 (cli-only) @angular-devkit/core 8.2.2 @angular-devkit/schematics 8.3.22 (cli-only) @ngtools/webpack 8.2.2 @schematics/angular 8.3.22 (cli-only) @schematics/update 0.803.22 (cli-only) rxjs 6.5.4 typescript 3.4.5 webpack 4.27.1

Describe the bug

I'm trying to implement onfido-ios-sdk for mu nativescript-angular app. Here is the repo - hello-onfido

As per ios-sdk guide, objective-c code

NSError *variantConfigError = NULL;
Builder *variantBuilder = [ONFaceStepVariantConfig builder];
[variantBuilder withPhotoCaptureWithConfig: NULL];
[configBuilder withFaceStepOfVariant: [variantBuilder buildAndReturnError: &variantConfigError]];

Nativesctipt code

this._faceVariantBuilder = ONFaceStepVariantConfig.builder();
 // console.log(this._faceVariantBuilder instanceof Builder);
this._faceVariantBuilder.withPhotoCaptureWithConfig(null);
this._configBuilder.withFaceStepOfVariant(this._faceVariantBuilder.buildAndReturnError(this._faceVariantError));

But _faceVariantBuilder created is NSObject, so I can not found withPhotoCaptureWithConfig method.

To Reproduce

Clone hello-onfido add ios platform, and run this app. It says,

file:///src/app/onfido/onfido.ts:80:28: [nativescript-onfido]: ERROR: TypeError: _this._faceVariantBuilder.withPhotoCaptureWithConfig is not a function. (In '_this._faceVariantBuilder.withPhotoCaptureWithConfig(null)', '_this._faceVariantBuilder.withPhotoCaptureWithConfig' is undefined)

Expected behavior

It should generate Builder type of object, instead of NSObject.

Sample project

hello-onfido

mbektchiev commented 4 years ago

Hi @heena-1993, thank you for the excellent report! We've made a fix for the issue and it will be released with version 6.4.1 of tns-ios.

mbektchiev commented 4 years ago

The RC has been published in NPM and you can now try it with tns platform add ios@rc