ios – Swift URL Session Response will get corrupted when utilizing ‘&’ image


I’m growing iOS app, I’m utilizing URL Session methodology for make API calls. Api response provides one property which accommodates AWS s3 hyperlink for pdf doc.

What ought to occur:
So on this app, I’m retrieving a PDF doc from the server to view within the app, so within the GET URL that I am sending will give a response of an entry hyperlink of the pdf doc generated by means of AWS S3.

What is occurring now:

Doc identify: Doc/sdd3343-sfnf0asdnd0UserB&ServiceLetter.pdf (discover there’s an ‘&’ signal)

Within the android and Swagger utility, this GET URL is working excellent on any circumstances.
however within the iOS version- within the URL session, when ever when there’s a ‘&’ signal contained in the doc’s identify, the responding entry hyperlink will get corrupted.

Now in Android and Swagger, once we are accessing the identical doc, it really works completely, however for iOS it would not.

URL that does not work on iOS however that works in Android and Swagger:


Above url having parameter identify known as ‘S3Key’ worth is Doc/sdd3343 sfnf0asdnd0UserB&ServiceLetter.pdf and it having an ampersand ‘&’ image in center of the identify.

iOS response for the above URL:


In right here you’ll be able to see the response which bought by the URL Session. However the reponse url physique lower off from ampersand image.

Present Response: /Doc/sdd3343-sfnf0asdnd0UserB?X-Amz-Expires=3600&X………

Anticipated Response: /Doc/sdd3343-sfnf0asdnd0UserB&ServiceLetter.pdf?X-Amz-Expires=3600&X………

The best way to clear up this URL Session drawback


Leave a Reply

Your email address will not be published. Required fields are marked *