我正在项目中https://github.com/kuapay/iOS-QR-Code-Generator上使用QR码创建项目。我已完全按照说明进行添加。
我可以毫无问题地在测试设备上编译和运行项目,但是当我尝试对其进行存档时,出现以下错误:
路径/到/项目/条形码.mm:67:33:没有匹配功能可调用'CGImageCreateWithMaskingColors'
我正在把头发拉出来。这是它的代码片段以及正在使用的变量声明。
CGImageRef rawImageRef = image.CGImage;
const float colorMasking[6] = {222, 255, 222, 255, 222, 255};
UIGraphicsBeginImageContext(image.size);
CGImageRef maskedImageRef = CGImageCreateWithMaskingColors(rawImageRef, colorMasking);
最佳答案
我知道提问者找到了答案,但是我的问题是发布构建应该没有。因为我们也需要非 Activity 架构!
问题在于XCode在新的XCode 5.1(5B130a)中对64位版本的类型更为严格。 CGImageCreateWithMaskingColors的第二个参数是CGFloat,因此将类型从float更改为CGFloat即可解决。
//const float colorMasking[6] = {222, 255, 222, 255, 222, 255};//before
const CGFloat colorMasking[6] = {222, 255, 222, 255, 222, 255};//after
UIGraphicsBeginImageContext(image.size);
CGImageRef maskedImageRef = CGImageCreateWithMaskingColors(rawImageRef, colorMasking);
关于ios - CGImageCreateWithMaskingColors没有匹配的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19259333/