From 2ffbacca08a3c8a9e63e11b2ffbb64f37ac37b8e Mon Sep 17 00:00:00 2001 From: Ran Greenberg Date: Sun, 10 Jul 2016 15:21:18 +0300 Subject: [PATCH] bugfix - support for iOS8 "fetchOptions.fetchLimit" --- example/CameraScreen.ios.js | 5 +++-- ios/lib/ReactNativeCameraKit/CKCamera.m | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/example/CameraScreen.ios.js b/example/CameraScreen.ios.js index 1d58438..069f151 100644 --- a/example/CameraScreen.ios.js +++ b/example/CameraScreen.ios.js @@ -93,7 +93,7 @@ export default class CameraScreen extends Component { } async onSwitchCameraPressed() { - const success = await this.camera.changeCamera(); + const success = await this.camera.changeCamera(); } async onCheckAuthoPressed() { @@ -107,7 +107,8 @@ export default class CameraScreen extends Component { } async onSetFlash(flashMode) { - const success = await this.camera.setFleshMode(flashMode); + const success = await this.camera.setFlashMode(flashMode); + } async onTakeIt() { diff --git a/ios/lib/ReactNativeCameraKit/CKCamera.m b/ios/lib/ReactNativeCameraKit/CKCamera.m index 704b07a..cf8a3d2 100644 --- a/ios/lib/ReactNativeCameraKit/CKCamera.m +++ b/ios/lib/ReactNativeCameraKit/CKCamera.m @@ -101,7 +101,10 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{ if (!_fetchOptions) { PHFetchOptions *fetchOptions = [PHFetchOptions new]; fetchOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]]; - fetchOptions.fetchLimit = 1; + // iOS 9+ + if ([fetchOptions respondsToSelector:@selector(fetchLimit)]) { + fetchOptions.fetchLimit = 1; + } _fetchOptions = fetchOptions; } return _fetchOptions;