【发布时间】:2013-04-15 20:28:13
【问题描述】:
我正在尝试使用http://github.com/TheLevelUp/ZXingObjC 在我的 Mac 应用上创建二维码。
它适用于每种条形码类型,但在 QRcode 上返回 nil! “结果”和“错误”都是空的。这是我的代码:
NSError* error = nil;
ZXMultiFormatWriter* writer = [[ZXMultiFormatWriter alloc] init];
ZXBitMatrix* result = [writer encode:@"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"
format:kBarcodeFormatQRCode
width:1750
height:1750 hints:[[ZXEncodeHints alloc] init] error:&error];
if (result) {
CGImageRef image = [[ZXImage imageWithMatrix:result] cgimage];
self.image.image = [[NSImage alloc] initWithCGImage:image size:NSMakeSize(1750, 1750)];
} else {
NSLog(@"error: %@", error);
}
这有什么问题?
【问题讨论】:
-
您能否将您的二维码拆分为一个显示此问题的示例 Mac 应用程序?项目中的示例应用程序是一个 iOS 应用程序,适用于我。
-
当然彼得,示例 iOS 示例适用于我,但在 mac 上,它不会创建条形码!我将创建一个示例项目并在此处发布以进行测试。
标签: objective-c macos cocoa qr-code