diff --git a/Examples/UIExplorer/UIExplorer/Info.plist b/Examples/UIExplorer/UIExplorer/Info.plist index d2e82af92..e614ce408 100644 --- a/Examples/UIExplorer/UIExplorer/Info.plist +++ b/Examples/UIExplorer/UIExplorer/Info.plist @@ -56,5 +56,7 @@ UIViewControllerBasedStatusBarAppearance + NSPhotoLibraryUsageDescription + You need to add NSPhotoLibraryUsageDescription key in Info.plist to enable photo library usage, otherwise it is going to *fail silently*! diff --git a/Libraries/CameraRoll/RCTCameraRollManager.m b/Libraries/CameraRoll/RCTCameraRollManager.m index 83519a059..1e0b5c23e 100644 --- a/Libraries/CameraRoll/RCTCameraRollManager.m +++ b/Libraries/CameraRoll/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 diff --git a/Libraries/Geolocation/RCTLocationObserver.m b/Libraries/Geolocation/RCTLocationObserver.m index 319477c99..e09cad5dc 100644 --- a/Libraries/Geolocation/RCTLocationObserver.m +++ b/Libraries/Geolocation/RCTLocationObserver.m @@ -174,7 +174,7 @@ RCT_EXPORT_MODULE() RCT_EXPORT_METHOD(startObserving:(RCTLocationOptions)options) { - [self checkLocationConfig]; + checkLocationConfig(); // Select best options _observerOptions = options; @@ -201,7 +201,7 @@ RCT_EXPORT_METHOD(getCurrentPosition:(RCTLocationOptions)options withSuccessCallback:(RCTResponseSenderBlock)successBlock errorCallback:(RCTResponseSenderBlock)errorBlock) { - [self checkLocationConfig]; + checkLocationConfig(); if (!successBlock) { RCTLogError(@"%@.getCurrentPosition called with nil success parameter.", [self class]); @@ -339,12 +339,14 @@ RCT_EXPORT_METHOD(getCurrentPosition:(RCTLocationOptions)options } } -- (void)checkLocationConfig +static void checkLocationConfig() { +#if RCT_DEV if (!([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] || [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"])) { RCTLogError(@"Either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription key must be present in Info.plist to use geolocation."); } +#endif } @end