I have image loaded from UIImagePickerController into UIImageView
I need to convert the image into string to send it to the server
This is my code but it gives an error
var imageData:String = "";
if let unwrappedImage = profileImage.image {
let imageNSData : NSData = UIImageJPEGRepresentation(unwrappedImage, 1.0)!;
imageData = (NSString(data:imageNSData, encoding:NSUTF8StringEncoding) as String?)!
}
I am getting the following exception
fatal error: unexpectedly found nil while unwrapping an Optional value
can any one help please