[AC-5744] iOS: Requesting permissions to open gallery will not allow gallery to open.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Cannot Reproduce |
Resolution Date | 2018-05-21T09:01:05.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | ios |
Reporter | Joshua A. Ceaser |
Assignee | Shak Hossain |
Created | 2018-05-20T22:46:05.000+0000 |
Updated | 2018-05-21T14:33:40.000+0000 |
Description
When requesting gallery permissions, after accepting permissions the gallery does not open.
Steps to reproduce:
1. Create a sample application
2. Update the index.js with the attached
3. Update the alloy.js with the attached to force splashscreen as snapshot.
4. Update the tiapp.xml with the NSPhotoLibraryUsageDescription and NSPhotoLibraryAddUsageDescription key in the attached tiapp.xml
5. Run the application and click on "Hello World"
6. Accept permissions
7. Notice nothing happens.
index.js
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
function doClick(e) {
var _galleryOptions = {
allowEditing : false,
allowMultiple : false,
autohide : true,
mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]
};
if (Ti.Media.hasPhotoGalleryPermissions()) {
Ti.Media.openPhotoGallery(_galleryOptions);
} else {
Ti.Media.requestPhotoGalleryPermissions(function(_evt) {
if (_evt.success) {
Ti.Media.openPhotoGallery(_galleryOptions);
} else {
alert('We need gallery permissions');
}
});
}
}
var btn = Ti.UI.createButton({
title: 'Trigger'
});
btn.addEventListener('click', doClick);
win.add(btn);
win.open();
tiapp.xml
<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>
alloy.js
Ti.App.forceSplashAsSnapshot = true
Works fine here (both with main- and kroll-thread). Try to reinstall your app or reach out to the community via Slack or Stackoverflow for more questions.
I left out the forceSplashAsSnapshot must be set to true.
Thats a very important detail, hehe. In that case, it is a duplicate of TIMOB-26047 which already has a fix in place that you can use today. Cheers!