From c4b9a1e013ab78450da5167fe9141fcf9fc4a978 Mon Sep 17 00:00:00 2001 From: Martin Kralik Date: Thu, 18 Aug 2016 07:16:26 -0700 Subject: [PATCH] check for NSPhotoLibraryUsageDescription in plist Reviewed By: javache Differential Revision: D3723122 fbshipit-source-id: a5393c7dd3c36a15bec3f2e79859920419cc6726 --- RCTCameraRollManager.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/RCTCameraRollManager.m b/RCTCameraRollManager.m index 83519a059..1e0b5c23e 100644 --- a/RCTCameraRollManager.m +++ b/RCTCameraRollManager.m @@ -147,6 +147,8 @@ RCT_EXPORT_METHOD(getPhotos:(NSDictionary *)params resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) { + checkPhotoLibraryConfig(); + NSUInteger first = [RCTConvert NSInteger:params[@"first"]]; NSString *afterCursor = [RCTConvert NSString:params[@"after"]]; NSString *groupName = [RCTConvert NSString:params[@"groupName"]]; @@ -221,4 +223,13 @@ RCT_EXPORT_METHOD(getPhotos:(NSDictionary *)params }]; } +static void checkPhotoLibraryConfig() +{ +#if RCT_DEV + if (![[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSPhotoLibraryUsageDescription"]) { + RCTLogError(@"NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll."); + } +#endif +} + @end