【发布时间】:2019-10-21 15:57:36
【问题描述】:
此方法返回一个字符串的二维码图像。它在 Ios 12.0.1 (iphone SE) 上正常工作,但在 12.4.2 (iphone 6) 上崩溃。当我尝试将结果UIImage 分配给UIImageView 时,方法崩溃,结果UIImage 不为零。
-(UIImage*)get_QR_image :(NSString*)qrString :(UIColor*)ForeGroundCol :(UIColor*)BackGroundCol{
NSData *stringData = [qrString dataUsingEncoding: NSUTF8StringEncoding];
CIFilter *qrFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
[qrFilter setValue:stringData forKey:@"inputMessage"];
[qrFilter setValue:@"H" forKey:@"inputCorrectionLevel"];
CIImage *qrImage = qrFilter.outputImage;
float scaleX = 320;
float scaleY = 320;
CIColor *iForegroundColor = [CIColor colorWithCGColor:[ForeGroundCol CGColor]];
CIColor *iBackgroundColor = [CIColor colorWithCGColor:[BackGroundCol CGColor]];
CIFilter * filterColor = [CIFilter filterWithName:@"CIFalseColor" keysAndValues:@"inputImage", qrImage, @"inputColor0", iForegroundColor, @"inputColor1", iBackgroundColor, nil];
CIImage *filtered_image = [filterColor valueForKey:@"outputImage"];
filtered_image = [filtered_image imageByApplyingTransform:CGAffineTransformMakeScale(scaleX, scaleY)];
UIImage *result_image = [UIImage imageWithCIImage:filtered_image
scale:[UIScreen mainScreen].scale
orientation:UIImageOrientationUp];
return result_image;
}
崩溃涉及的行是:
filtered_image = [filtered_image imageByApplyingTransform:CGAffineTransformMakeScale(scaleX, scaleY)];
它会生成这个日志:
warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.
我的方法中有一些东西只适用于 12.0.1 吗?或者可能有什么问题?我如何进行更多调查以解决该崩溃?
编辑
我有红色:
MyQrCodeImageViewBig.image=qrimage;
带有消息:
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1a83e146c)
【问题讨论】:
-
您能否发布崩溃消息本身?
-
我添加了有关崩溃的更多信息
标签: ios uiimage core-image ciimage