nativescript-community / https

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

iOS > Invalid certificate error but same working in android #71

Closed anshulbisht06 closed 3 years ago

anshulbisht06 commented 3 years ago

This is the output I get when I request a api url from my iOS application -

{
  "task": null,
  "reason": "The operation couldn’t be completed. The `parameters` argument is not valid JSON.",
  "headers": {},
  "failure": {
    "description": "nativescript-https > Invalid SSL certificate! Error Domain=com.alamofire.error.serialization.request Code=-1016 \"The `parameters` argument is not valid JSON.\" UserInfo={NSLocalizedFailureReason=The `parameters` argument is not valid JSON.}",
    "reason": "The operation couldn’t be completed. The `parameters` argument is not valid JSON.",
    "url": "https://sab.xxxxxxx.com/gattu/login/"
  },
  "content": null
}

I am checking on an emulator (iPhone 11). The same configuration with same certificate is working correctly in android. I need help. It is very urgent. @EddyVerbruggen

anshulbisht06 commented 3 years ago

I solved this. The "content" property for POST/PUT/PATCH takes different values for android and iOS. For android, we have to stringify the "content" object and for iOS, we have supply as it is.