[TIMOB-27984] iOS 14: Use PHPicker for for accessing PhotoLibrary
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-09-16T18:58:19.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.2.0 |
Components | iOS |
Labels | photogallery |
Reporter | Vijay Singh |
Assignee | Vijay Singh |
Created | 2020-06-24T19:46:06.000+0000 |
Updated | 2020-09-16T18:58:19.000+0000 |
Description
Apple has introduced PHPicker in PhotosUI framework to handle PhotoLibrary instead of UIImagePickerViewController. UIImagePickerViewController is deprecated in iOS 14. PHPicker has new API to select multiple photos.
Details can be found https://developer.apple.com/documentation/photokit/phpickerviewcontroller
https://developer.apple.com/documentation/photokit/phpickerconfiguration
On comparing UIImagePickerViewController and PHPicker APIs wrt [Ti.Media.openPhotoGallary](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-method-openPhotoGallery), I found that following 2 properties are not supported in PHPicker APIs - 1. [allowEditing](https://docs.appcelerator.com/platform/latest/#!/api/PhotoGalleryOptionsType-property-allowEditing) 2. [allowTranscoding](https://docs.appcelerator.com/platform/latest/#!/api/PhotoGalleryOptionsType-property-allowTranscoding) 'allowEditing' is important feature and I believe many developers will be using it. So we can not replace UIImagePickerViewController completely. But Apple has deprecated it for PhotoLibrary handling, so we should also plan for same. And PHPicker has new API to select multiple images, which is a cool feature. Solution - If "allowEditing" is set to
true
or "allowTranscoding" istrue
while calling [Ti.Media.openPhotoGallary](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-method-openPhotoGallery), use UIImagePickerViewController (current implementation) to show Photo Library, with a deprecation warning. Otherwise use PHPickerViewController (PHPicker API) to show Photo Library. And in future major release these APIs can be removed. cc [~amukherjee] [~cwilliams] Let me know if you have any other thought. Edit - I will create a new ticket to deprecate "allowEditing" and "allowTranscoding" API which is not supported in PHPicker.PR - https://github.com/appcelerator/titanium_mobile/pull/11867 Test Case -
FR Passed On iOS 14 - Able to select multiple photo, live photo or video or a combination of these media types upto the defined selection limit. On iOS 13.x - The selection of single item of a media type works fine as before.
Waiting for Jenkins build
Verified on: Mac OS: 10.15.4 SDK: 9.2.0.v20200915123928, 9.3.0.v20200915132757 Appc CLI: 8.1.1 JDK: 11.0.4 Node: 10.17.0 Studio: 6.0.0.202005141803 Xcode: 12.0 GM iPhone 7Plus(v14.0 GM), iPhone X(v13.6.1)