From 0c9de56da59cc06d1e8680afbc6c96437c9b41cd Mon Sep 17 00:00:00 2001 From: RemeR Date: Tue, 29 Apr 2014 12:30:50 -0300 Subject: [PATCH] CB-6576 - Returns a specific error message when app has no access to library. Signed-off-by: Shazron Abdullah --- src/ios/CDVCamera.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m index 9981747..8c11e60 100644 --- a/src/ios/CDVCamera.m +++ b/src/ios/CDVCamera.m @@ -24,6 +24,7 @@ #import #import #import +#import #import #import #import @@ -392,7 +393,13 @@ static NSSet* org_apache_cordova_validArrowDirections; } // popoverControllerDidDismissPopover:(id)popoverController is called if popover is cancelled - CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no image selected"]; // error callback expects string ATM + CDVPluginResult* result; + if ([ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusAuthorized) { + result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no image selected"]; // error callback expects string ATM + } else { + result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"has no access to assets"]; // error callback expects string ATM + } + [self.commandDelegate sendPluginResult:result callbackId:cameraPicker.callbackId]; self.hasPendingOperation = NO;