samedi 25 avril 2015

decodedImage from base64 return nil while after assign into UIImage


I tried to decoded my image Data from NSData base64EncodedString but i got nil when i putted decodedData into decodedImage

This is my code

self.base64String = snapshot.value.objectForKey("profileimage") as! String
var decodedData = NSData(base64EncodedString: snapshot.value.objectForKey("profileimage") as! String, options: NSDataBase64DecodingOptions(rawValue: 0))
var decodedImage = UIImage(data: decodedData!)

println(decodedData!) // return <89504e47 0d0a1a0a 0000000d 49484452 00000153 00000116 08020000 0054bce3 fc000000 01735247 4200aece 1ce90000 001c6944 4f540000 00020000 00000000 008b0000 00280000 008b0000 008b0001 904ef7da>

println(decodedImage) // return nil

Any ideas?

Thanks!


Aucun commentaire:

Enregistrer un commentaire