https icon indicating copy to clipboard operation
https copied to clipboard

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

Open linksmt opened this issue 5 years ago • 1 comments

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"!

linksmt avatar Dec 03 '19 14:12 linksmt

Can you please send a PR?

EddyVerbruggen avatar Dec 03 '19 14:12 EddyVerbruggen