You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using this animatedImage with a URL from online
let urlString = "URLFROMINTERNET"
let animatedImage = XAnimatedImage(initWithAnimatedGIFData: NSData(contentsOfURL: NSURL(string: urlString!)!)!)
Everything is good, but if I was to put the app into aeroplane mode and scroll though the tableview where the animated image is displayed it will crash with the error
fatal error: unexpectedly found nil while unwrapping an Optional value
Any ideas how to stop this?
The text was updated successfully, but these errors were encountered:
Theoretically, without replicating the error (which I will get to later) I believe that the optional value should fail gracefully which doesn't seem to be the case currently. I'm certain it will require 'optional chaining' rather than forced unwrapping as mentioned here.
However, as a current workaround let me refer to this Reachability class. This will detect the iPhone connectivity status and could be used to guard against any potential nil values.
Keep in mind that its a suggestion and not foolproof. I offer it in case you are under tight time constraints.
I am using this animatedImage with a URL from online
let urlString = "URLFROMINTERNET"
let animatedImage = XAnimatedImage(initWithAnimatedGIFData: NSData(contentsOfURL: NSURL(string: urlString!)!)!)
Everything is good, but if I was to put the app into aeroplane mode and scroll though the tableview where the animated image is displayed it will crash with the error
fatal error: unexpectedly found nil while unwrapping an Optional value
Any ideas how to stop this?
The text was updated successfully, but these errors were encountered: