telenordigital / connect-ios-sdk

Docs 📒👉
https://telenordigital.github.io/id-docs.telenordigital.com/integrate-ios-sdk.html
Apache License 2.0
9 stars 8 forks source link

Validation and changing the way how to create the request. #39

Closed SergioDan closed 6 years ago

SergioDan commented 6 years ago

Hi,

I am working on a project that uses this sdk, and I found a crash using a limited or very bad internet connection.

When that request reaches a timeout or the server responds an error, the data is nil, and, as there is no validation, the app crashes.

In order to avoid the crash, I added a simple validation of the callback parameters, and changed the way to create that request, because of the deprecation of [NSURLConnection sendAsynchronousRequest:queue:completionHandler:]method in iOS 9.

In addition, I added a single test of the modified method to ensure that everything looks good.

Minor changes were added in order to compile the project (due to recommendations of the IDE) and to run the test.

I removed the previous PR and created this one to be more organized and clear. I saw and tried to follow all of your feedback.