Crash because of [__NSCFNumber isEqualToString:] when specified imageType in takePictureAsync
EagleVee opened this issue · comments
Bug Report
To Do First
- Did you try latest release?
- Did you try master?
- Did you look for existing matching issues?
Platforms
iOS
Versions
- Android:
- iOS: Any iOS 14+
- react-native-camera: 4.2.1
- react-native: 0.63.3
- react: 16.13.1
Description/Current Behaviour
When used prop imageType on iOS for takePictureAsync
, app crash.
The error doesn't show on React Native Debugger, but I found it in XCode Console:
Fatal Exception: NSInvalidArgumentException
-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0x90d1138348a582b1
I believe the error is around these lines in RNCamera.m, line 838-843
NSString *imageExtension = @".jpg";Í
if ([options[@"imageType"] isEqualToString:@"png"]) {
imageType = RNCameraImageTypePNG;
imageTypeIdentifier = kUTTypePNG;
imageExtension = @".png";
}
Expected Behaviour
Take picture success, app doesn't crash
Steps to Reproduce
const response = await cameraRef.current.takePictureAsync({
width: deviceWidth,
fixOrientation: true,
forceUpOrientation: true,
orientation: RNCamera.Constants.Orientation.portrait,
imageType: RNCamera.Constants.ImageType.jpeg,
});
Additionals
Love react-native-camera? Please consider supporting our collective: 👉 https://opencollective.com/react-native-camera/donate
Want this issue to be resolved faster? Please consider adding a bounty to it https://issuehunt.io/repos/33218414