alasset

Getting video from ALAsset

心已入冬 提交于 2019-11-26 12:57:16
问题 Using the new asset library framework available in iOS 4 i see that I can get the url for a given video using the UIImagePickerControllerReferenceURL. The url returned is in the following format: assets-library://asset/asset.M4V?id=1000000004&ext=M4V I am trying to upload this video to a website so as a quick proof of concept I am trying the following NSData *data = [NSData dataWithContentsOfURL:videourl]; [data writeToFile:tmpfile atomically:NO]; Data is never initialized in this case. Has

How to get an ALAsset URL from a PHAsset?

若如初见. 提交于 2019-11-26 06:43:45
问题 You can do it sneakily† using the undocumented PHAsset.ALAssetURL property, but I\'m looking for something documented. † In Objective-C, this will help @interface PHAsset (Sneaky) @property (nonatomic, readonly) NSURL *ALAssetURL; @end 回答1: Create the assetURL by leveraging the localidentifier of the PHAsset . Example: PHAsset.localidentifier returns 91B1C271-C617-49CE-A074-E391BA7F843F/L0/001 Now take the 32 first characters to build the assetURL, like: assets-library://asset/asset.JPG?id