Skip to content

Commit

Permalink
Fixed QR code crash in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vineetchoudhary committed Apr 19, 2018
1 parent edf1407 commit 8e0eb00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion AppBox.xcodeproj/xcshareddata/xcschemes/AppBox.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import "QRCodeViewController.h"

@implementation QRCodeViewController{
CGImageRef qrCodeImage;
}

- (void)viewDidLoad {
Expand All @@ -30,12 +29,8 @@ - (void)viewDidLoad {
ZXMultiFormatWriter *writer = [ZXMultiFormatWriter writer];
ZXBitMatrix *result = [writer encode:url format:kBarcodeFormatQRCode width:250 height:250 error:&error];
if (result){
qrCodeImage = [[ZXImage imageWithMatrix:result] cgimage];
if (qrCodeImage) {
NSImage *image = [[NSImage alloc] initWithCGImage:qrCodeImage size:NSMakeSize(250, 250)];
[imageViewQRCode setImage:image];
CGImageRelease(qrCodeImage);
}
NSImage *image = [[NSImage alloc] initWithCGImage:[[ZXImage imageWithMatrix:result] cgimage] size:NSMakeSize(250, 250)];
[imageViewQRCode setImage:image];
}else{
[Common showAlertWithTitle:@"Error" andMessage:error.localizedDescription];
}
Expand Down

0 comments on commit 8e0eb00

Please sign in to comment.