diff --git a/ios/lib/ReactNativeCameraKit/CKCamera.m b/ios/lib/ReactNativeCameraKit/CKCamera.m index cf8a3d2..885464f 100644 --- a/ios/lib/ReactNativeCameraKit/CKCamera.m +++ b/ios/lib/ReactNativeCameraKit/CKCamera.m @@ -118,14 +118,18 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{ - (void)removeFromSuperview { - [super removeFromSuperview]; + dispatch_async( self.sessionQueue, ^{ if ( self.setupResult == CKSetupResultSuccess ) { [self.session stopRunning]; [self removeObservers]; } + } ); + [super removeFromSuperview]; + + } - (instancetype)initWithFrame:(CGRect)frame { @@ -446,7 +450,7 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{ if (success) { PHFetchResult *fetchResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:self.fetchOptions]; - PHAsset *lastImageAsset = [fetchResult lastObject]; + PHAsset *lastImageAsset = [fetchResult firstObject]; if (lastImageAsset.localIdentifier) { imageInfoDict[@"id"] = lastImageAsset.localIdentifier; @@ -691,6 +695,7 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{ } + #pragma mark - observers diff --git a/package.json b/package.json index a14e022..d7798cd 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "publishConfig": { "registry": "https://registry.npmjs.org/" }, - "version": "1.0.10", + "version": "1.0.11", "description": "Advanced native camera control with pre-defined aspect ratio, crop, etc", "author": "Nataliia Hrankina ", "nativePackage": true,