我有这些代码在Tools.m
上打印QRCode:
#import <CoreImage/CoreImage.h>
...
+ (UIImage *)renderQRCodeFrom:(NSString *)source withImageViewFrameSize:(CGSize)imageViewFrameSize {
NSString *qrString = source;
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 = imageViewFrameSize.width / qrImage.extent.size.width;
float scaleY = imageViewFrameSize.height / qrImage.extent.size.height;
qrImage = [qrImage imageByApplyingTransform:CGAffineTransformMakeScale(scaleX, scaleY)];
return [UIImage imageWithCIImage:qrImage scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp];
}
但是当我编译它时,它显示错误:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_CIFilter", referenced from:
objc-class-ref in Tools.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
为什么会出现这种错误?我已正确包含CoreImage.h
,据我所知,我无法在网络上找到类似的错误,这意味着此错误不常见。我可以通过CMD +点击CIFilter,它会导致CoreImage/CIFilter.h
。
NS_CLASS_AVAILABLE(10_4, 5_0)
@interface CIFilter : NSObject <NSSecureCoding, NSCopying>
{
void *_priv[8];
}
...
我的项目部署目标设置为iOS 8.0。我在这个项目中使用没有ARC的Obj C。
答案 0 :(得分:0)
忘了这个问题。答案是不要忘记项目目标中的CoreImage 框架&gt;一般&gt;滚动到底部。
叹息。
symbol(s) not found for architecture armv7s (linker command failed with exit code 1)