Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
SWF-17305 - fixing new Xcode 9 build warning
Browse files Browse the repository at this point in the history
Xcode 9 was generating the following warning:

PBJVision.m:762:61: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
        _previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:nil];
                                                            ^               ~~~

I hacked in a simple, minimal fix, to keep from diverging from the original repo as much as possible. Instead of passing in nil, I pass in a local variable which is set to nil. Looks super ugly but it's good enough to shut the compiler up.

CR: Jon Moldover
  • Loading branch information
sclamage committed Sep 28, 2017
1 parent 400f6f2 commit 121293a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/PBJVision.m
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,10 @@ - (id)init
_captureSessionDispatchQueue = dispatch_queue_create("PBJVisionSession", DISPATCH_QUEUE_SERIAL); // protects session
_captureVideoDispatchQueue = dispatch_queue_create("PBJVisionVideo", DISPATCH_QUEUE_SERIAL); // protects capture
dispatch_set_target_queue( _captureVideoDispatchQueue, dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0 ) );

_previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:nil];

// passing in a variable set to nil here instead of a literal nil somehow prevents a nullable compiler warning
AVCaptureSession *session = nil;
_previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];
_previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;

_maximumCaptureDuration = kCMTimeInvalid;
Expand Down

0 comments on commit 121293a

Please sign in to comment.