Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27805] Open Photo Gallery not requiring permissions

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionNot Our Bug
Resolution Date2020-03-16T18:43:17.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterRay Belisle
AssigneeVijay Singh
Created2019-12-06T22:24:19.000+0000
Updated2020-03-16T18:43:22.000+0000

Description

When requesting access to the user's photo gallery on iOS, the app should not allow the gallery to display if permission has not been granted. Simple test: index.js
Titanium.Media.openPhotoGallery({
					success: function (event) {
						// alert( 'libraryHandler success: ' + JSON.stringify( event, null, 2 ) );
						_params.event = event;
						processImage(_params, false);
					},
					error: function (event) {
						alert('libraryHandler error: ' + JSON.stringify(event, null, 2));
						Titanium.API.info('Sending file error');
						Titanium.API.info(event);
					},
					mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
					allowEditing: true
				});
The photo gallery will display and you can select a photo and get a successful result.

Comments

  1. Fazlul Haque 2019-12-12

    Hello [~raybelisle], Thanks for reporting this issue. Can you please share us the steps to reproduce the issue? Did you check the issue on your physical device? Also, please try to check this issue on latest SDK 8.3.0.GA and add the following permission code on tiapp.xml file under section.
       <key>NSPhotoLibraryUsageDescription</key>
       <string>To allow you to upload photos of documents</string>
       <key>NSPhotoLibraryAddUsageDescription</key>
       <string>To allow you to upload photos of documents</string>
       
    Thanks
  2. Vijay Singh 2020-03-16

    As per [Apple doc](https://developer.apple.com/documentation/photokit/requesting_authorization_to_access_photos?language=objc) - "When using the UIImagePickerController to bring up the user's photo library, your app doesn't need to request permission explicitly." In titanium, UIImagePickerController is used to access user's photo gallery. I tested this on different iOS versions in native iOS app and behavior is as below - In iOS 10.x, it is mandatory to use the mentioned key otherwise it will crash. In iOS 11.0+, it is not mandatory to use. So mentioned issue is not an issue in titanium. It is similar behavior to native. If it is required to check for user's permission please use [requestPhotoGalaryPermissions](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-method-requestPhotoGalleryPermissions)

JSON Source