0

Regarding AVCaptureDevice

lockForConfiguration: 

https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/index.html#//apple_ref/occ/instm/AVCaptureDevice/lockForConfiguration:

According to document, each time we should acquire a lock when we want to change device configuration.

I wonder if lockForConfiguration: and unlockForConfiguration: should always runs in pairs. For example, if I first do lockForConfiguration: and then do another lockForConfiguration: without unlockForConfiguration, I wonder if this way will cause errors ?

blancos
  • 1,576
  • 2
  • 16
  • 38
user454083
  • 1,337
  • 3
  • 16
  • 31

1 Answers1

1

No, it will not cause any error. In fact it doesn't even matter how many times you lock it, once it is locked. For example, if you lock it thrice and unlock it once after that, it will be unlocked.

Since lockForConfiguration returns BOOL, you can just print the values by calling it any number of times and analysing the return values.

NOTE: But be sure to unlock it after locking it(how many ever times you want to lock it) because it may degrade performances and capture quality of other apps sharing the device.

blancos
  • 1,576
  • 2
  • 16
  • 38