My app keep crashing with the following message:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableData base64EncodedStringWithOptions:]: unrecognized selector sent to instance 0x776e920'
Here is part of the code. Any help will be appreciated:
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
// Saving the image in the uiimage "myImage".
UIImage *myImage = [info objectForKey:UIImagePickerControllerOriginalImage];
NSString *imageString = [self encodeToBase64String:myImage];
[self dismissViewControllerAnimated:YES completion:NULL];
}
- (NSString *)encodeToBase64String:(UIImage *)image{
NSString * test = [UIImagePNGRepresentation(image) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
return test;
}
I have checked and the UIImage has an image in it. Thanks.