This repository was archived by the owner on Jun 16, 2023. It is now read-only.
This repository was archived by the owner on Jun 16, 2023. It is now read-only.
Crash on second invocation #426
Closed
Description
Steps to reproduce
- Open a view with react-native-camera
- N.B. Not necessary to capture picture
- Close view
- Open view again
Expected behaviour
I'd expect the same behavior as at the first invocation.
Actual behaviour
Crash.
- (void)setCaptureQuality:(NSString *)quality
{
if (quality) {
[self.session beginConfiguration];
if ([self.session canSetSessionPreset:quality]) {
self.session.sessionPreset = quality;
}
[self.session commitConfiguration];
}
}
At [self.session commitConfiguration] XCode reports "EXC_BAD_ACCESS"
Environment
- Node.js 6.4:
- React Native 0.33:
- **iOS 10.0, simulator
react-native-camera
Version: lwansbrough/react-native-camera (6074ec3)
This is the version with the simulator fix
Activity
furkancelik commentedon Sep 26, 2016
I'm having the same problem too...!
msageryd commentedon Sep 26, 2016
N.B. the problem only exists in the simulator. Works fine on device.
JoschaP commentedon Sep 27, 2016
same problem here:
[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
Its fixed by adding the NSCameraUsageDescription key in Info.plist with a description of what u use the camera access for. its displayed in the popup when you request the camera access the first time
But another problem:
after u've given the camera access, u can use the camera only one time. the second time the app crashes again with the same error as before -.-
Error: Error setting property 'captureAudio' of RCTCamera with tag #342: capturing audio
andrerfneves commentedon Sep 27, 2016
This is relating to iOS 10.0. I fixed the issue with this inside Info.plist
The string can really be anything you want, it'll display when the app launches and asks for permissions to use the camera.
ibussieres commentedon Sep 27, 2016
@andrerfneves it does not fix for me. The second invocation crashes. I have the the NSCameraUsageDescription key set in my .plist files.
andrerfneves commentedon Sep 27, 2016
@ibussieres I didn't run into second invocation issues. But whenever I flipped the camera to the front camera the app crashed. I had to add the same key and string pair on the .plist file but for the Microphone native properties.
Not sure if this will fix your issue, but this is what helped me solve it.
msageryd commentedon Sep 28, 2016
As this only happens in the simulator I'm guessing that there is something more that needs to be wrapped in an
#if !(TARGET_IPHONE_SIMULATOR)
(see 6074ec3). Maybe there is something that should be initialized only once per session. Unfortunately I don't know Objective C, so I can't look into it.JoschaP commentedon Sep 28, 2016
@andrerfneves it does not fix it for me, too.
I've added both to the plist file:
<key>NSCameraUsageDescription</key> <string>This app uses the camera.</string> <key>NSMicrophoneUsageDescription</key> <string>This app uses the microphone.</string>
breaks at line: 988 of RCTCameraManager
[self.session commitConfiguration];
2016-09-28 14:16:48.562 [info][tid:main][RCTCameraManager.m:270] Error setting property 'captureAudio' of RCTCamera with tag #342: capturing audio
ibussieres commentedon Sep 28, 2016
@andrerfneves thanks for the hinters, unfortunately it does not work. Besides, I am using this package only for barcode scanning so I had disabled the microphone. I think @MichaelSWE has put the finger on the type of problem that we need to surface up. I'm not too good with Objective-C either, but I'll try to look into something (yet hoping someone with better Objective-C skills will, too ;) )
chrisnojima commentedon Sep 28, 2016
I have the same problem. It renders fine but if I switch screens and come back it'll crash. I'm running the iPhone 7 iOS 10.0 simulator. I have only the NSCameraUsageDescription as i have autoCapture turned off (and changing the microphone setting seems to change nothing regarding this issue).
For me it crashes at: https://github.com/lwansbrough/react-native-camera/blob/master/ios/RCTCameraManager.m#L988
comountainclimber commentedon Sep 28, 2016
I am experiencing a crash at the same place @chrisnojima have permission in info.plist for both camera and microphone...
This crash appears to only occur on simulator as others have stated above
miclaus commentedon Oct 1, 2016
+1 also have permissions in Info.plist
16 remaining items