Comments (5)
It is not advised to get the URL of the PHAsset
. Instead, you can request a UIImage version or a plain data version using PHImageManager
(yes you also use PHImageManager
for video).
This also allows you to get a cropped or resized version of the image and it handles iCloud downloading for you.
If you really do want to use (which again, is not advised) use can use the PHAssetResource
for a PHAsset
which will return a single or multiple resources based on the PHAsset
from tatsi.
Also as a side note: PHImageManager
will give an unclear error when a PHAsset's photo needs to be downloaded from iCloud AND low power mode is enabled. To get around this I've added a custom error message in the app telling the user that low power mode should be turned off to download the photo.
You can check for low power mode with the following code:
let lowerPowerModeEnabled = ProcessInfo.processInfo.isLowPowerModeEnabled
from tatsi.
Ok, thanks
I'm trying to use PHAssetResource, and obtain from this the URL.
After this, I need to show the result in a CollectionView and send all to server.
from tatsi.
Thanks a lot!
I've resolved!
func pickerViewController(_ pickerViewController: TatsiPickerViewController, didPickAssets assets: [PHAsset]) { pickerViewController.dismiss(animated:true, completion: nil) for ass in assets{ let res2:[PHAssetResource] = PHAssetResource.assetResources(for: ass) let obj = res2[0] as NSObject let strURL = obj.value(forKey: "_fileURL") as! NSURL let data = try? Data(contentsOf: strURL as URL) let img = UIImage(data: data!) } }
from tatsi.
This image getting URL:
Assets [<PHAsset: 0x11dc12570> 2E25AD2C-51D8-4431-882F-AC8CA2E8F65B/L0/001 mediaType=1/0, sourceType=1, (3024x4032), creationDate=2019-04-08 10:04:57 +0000, location=0, hidden=0, favorite=0 ]
This image not getting URL: (app will crash for data nil)
Assets [<PHAsset: 0x11dc065f0> 420A3B33-A758-4EC3-9DC1-D72AC88B98C9/L0/001 mediaType=1/4, sourceType=1, (1242x2208), creationDate=2019-04-11 07:14:37 +0000, location=0, hidden=0, favorite=0 ]
what are the difference b/w the above two Assets, How to resolve this issue ?
from tatsi.
Related Issues (20)
- Do not count the number of photos in the album every time. They can be cached. HOT 2
- Small 50x50 thumbnails on iOS 13 when modalPresentationStyle is fullscreen
- Swift Package Manager support
- Finish and Album button are not visible due to the white color HOT 3
- iOS 13 Memory Issue HOT 4
- 1.1.7 Cocoapods release HOT 1
- Tatsi crashes on `PHImageManager.requestImage` HOT 1
- Wrong navigation bar padding when presented as second modal view controller HOT 1
- Its not "Support for smart albums, user created albums and iCloud shared albums" HOT 1
- Last selected album or library HOT 2
- Image selection sequence issue and number show of selection HOT 3
- Preselected images when the picker is opened HOT 9
- Low Quality Images after Importing! HOT 4
- video max duration HOT 1
- Link color configuration not completely implemented HOT 1
- Is this project still necessary? HOT 1
- Reusable cell HOT 1
- Handling PHAuthorizationStatus.limited HOT 1
- Integration with SwiftUI HOT 2
- drag finger to select multiple not supported HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tatsi.