Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Querying returned NSError
-
Hello,
I'm trying to query a NSError object returned from on an AVFoundation call by reference.
The ObjectiveC Definition is- (instancetype)deviceInputWithDevice:(AVCaptureDevice *)device
error:(NSError **)outError;
I tried many combinations and can't figure it out:
err = c_void_p()
print err
err1 = pointer(err)
print err1A)
deviceInput2=ObjCClass('AVCaptureDeviceInput').deviceInputWithDevice_error_(self.inputDevice2, byref(err1) )
print err1
B)
deviceInput2=ObjCClass('AVCaptureDeviceInput').deviceInputWithDevice_error(self._inputDevice2, err1 )
print err1What I get is
c_void_p(None)
<objc_util.LP_c_void_p object at 0x10762af48>A) c_void_p(None)
B) <objc_util.LP_c_void_p object at 0x10762af48>What is the right way to do this and to get the NSError in the end?
All examples I found just seem to ignore the NSError by using None.
Many thanks!
- (instancetype)deviceInputWithDevice:(AVCaptureDevice *)device
-
Something like this should work:
err_ptr = c_void_p() device_input = ObjCClass('AVCaptureDeviceInput').deviceInputWithDevice_error_(input_device, byref(err_ptr)) if err_ptr: err = ObjCInstance(err) print(err)