I have this code
YASAPIClient.sharedClient.getUserStepsOfDay(email, completionBlock: { (request, result, error, isCancelled, status) in
if error != nil {
error?.showServerErrorInViewController(self)
} else if !isCancelled {
print(result)
if let myStr = result as? String {
// Here, `result` is String
print(myStr)
}
}
})
in my case result is an AnyObject as you can see in screenshot
I have seen several questions on SO but I am not able to convert this AnyObject to String. When I print result it gives "Optional(0)" and I want 0 instead. And my second print statement is not executing.
Aucun commentaire:
Enregistrer un commentaire