Here my code for conversion a image,
CGSize newSize1=CGSizeMake(720.00, 576);
self.imageData = [PDFImageConverter convertImageToPDF:image1 withResolution:300 maxBoundsRect:CGRectMake(0, 0, 194, 154) pageSize:newSize1];
largerbtn.selected=YES;
smallerbtn.selected=NO;
CGSize newSize=CGSizeMake(194, 154);
UIGraphicsBeginImageContext(newSize);
[image1 drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//NSData *imageData1
imageData1=UIImageJPEGRepresentation(newImage, 1.0);
//NSString *encodedString
encodedString= [Base64 encode:imageData1];//crashed when it reached here
NSLog(@"%@",encodedString);
The application getting crashed when it reaches the base64 conversion,What wrong with my code.Please help me to solve this issue.
// Use this line
imageData1=UIImageJPEGRepresentation(newImage, 1.0);
NSString *encodedString = [imageData base64Encoding];
Use
[Base64 initialize];
before using
[Base64 encode:imageData1].
Hope it helps.
you miss initialization of Base64 class as
[Base64 initialize];
include this line, before you try to encode
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.