ibm-bluemix-mobile-services/bms-clientsdk-swift-push

Forcecasts causing crashes in BMSPushClient.swift

Closed this issue · 1 comments

Hi @AnanthaKrish

Crashlytics is reporting crashes when library is trying to force unwrap null values in BMSPushClient.swift
This is an issue even with the updated library as force unwraps are widely used.
For example with:
let rToken = jsonResponse.object(forKey: IMFPUSH_TOKEN) as! String
Specially when dealing with improper server responses, unwrapping an improper response will cause a crash.

The ideal way of dealing with this is to nil coalesce them and not cause the null pointer exception. So in these cases where data is null, with null coalescing, we should be able instead use a default value or if necessary direct the developer to a failure callback.

@rajishere Sure we will take care of that ... Thanks