这是我转换图片的代码,
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);
达到base64转换时,应用程序崩溃了,我的代码有什么问题。请帮助我解决此问题。
最佳答案
// Use this line
imageData1=UIImageJPEGRepresentation(newImage, 1.0);
NSString *encodedString = [imageData base64Encoding];