nativescript-community / https

Secure HTTP client with SSL pinning for Nativescript - iOS/Android
https://nativescript-community.github.io/https/
Other
50 stars 42 forks source link

[iOS] - Change function AFSuccess(resolve, task: NSURLSessionDataTask, data: NSDictionary<string, any> & NSData & NSArray<any>) { #53

Open linksmt opened 4 years ago

linksmt commented 4 years ago

There's a problem with function: function AFSuccess(resolve, task: NSURLSessionDataTask, data: NSDictionary<string, any> & NSData & NSArray)

if (data.enumerateKeysAndObjectsUsingBlock || data.class().name === 'NSArray' || **(data instanceof NSArray) === true**) {
      let serial = NSJSONSerialization.dataWithJSONObjectOptionsError(data, NSJSONWritingOptions.PrettyPrinted);
      content = NSString.alloc().initWithDataEncoding(serial, NSUTF8StringEncoding).toString();
    } else if (data.class().name === 'NSData' || **(data instanceof NSData) === true**) {

Should be used "instanceof"!

EddyVerbruggen commented 4 years ago

Can you please send a PR?