photosframework

How to use PHPhotoLibrary like ALAssetsLibrary

余生长醉 提交于 2019-11-29 01:46:23
For iOS9, ALAssetsLibrary is deprecated. So how to change it as PHPPhotoLibrary instead of ALAssets ? if (RecordedSuccessfully && recording == NO) { //----- RECORDED SUCESSFULLY ----- NSLog(@"didFinishRecordingToOutputFileAtURL - success"); ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:outputFileURL]) { [library writeVideoAtPathToSavedPhotosAlbum:outputFileURL completionBlock:^(NSURL *assetURL, NSError *error) { if (error) { } }]; } // i have tried this, but didnt work [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{

How can I determine file size on disk of a video PHAsset in iOS8

余生颓废 提交于 2019-11-27 18:17:59
问题 I can request a video PHAsset using the Photos framework in iOS8. I'd like to know how big the file is on disk. There doesn't seem to be a property of PHAsset to determine that. Does anyone have a solution? (Using Photos framework not required) 回答1: Edit As for iOS 9.3, using requestImageDataForAsset on a video type PHAsset will result in an image, which is the first frame of the video, so it doesn't work anymore. Use the following method instead, for normal video, request option can be nil ,

How to use PHPhotoLibrary like ALAssetsLibrary

好久不见. 提交于 2019-11-27 16:14:17
问题 For iOS9, ALAssetsLibrary is deprecated. So how to change it as PHPPhotoLibrary instead of ALAssets ? if (RecordedSuccessfully && recording == NO) { //----- RECORDED SUCESSFULLY ----- NSLog(@"didFinishRecordingToOutputFileAtURL - success"); ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:outputFileURL]) { [library writeVideoAtPathToSavedPhotosAlbum:outputFileURL completionBlock:^(NSURL *assetURL, NSError *error) { if (error)

How to get only images in the camera roll using Photos Framework

痴心易碎 提交于 2019-11-27 08:02:28
The following code loads images that are also located on iCloud or the streams images. How can we limit the search to only images in the camera roll? var assets = PHAsset.fetchAssetsWithMediaType(PHAssetMediaType.Image, options: nil) After adding the Camera Roll and Photo Stream albums, Apple added the following PHAssetCollectionSubtype types in iOS 8.1: PHAssetCollectionSubtypeAlbumMyPhotoStream (together with PHAssetCollectionTypeAlbum ) - fetches the Photo Stream album. PHAssetCollectionSubtypeSmartAlbumUserLibrary (together with PHAssetCollectionTypeSmartAlbum ) - fetches the Camera Roll

NSURL from PHAsset

巧了我就是萌 提交于 2019-11-27 03:49:31
I'm converting our app over to use the Photos Framework of iOS8, the ALAsset framework is clearly a second class citizen under iOS8. I'm having a problem is that our architecture really wants an NSURL that represents the location of the media on "disk." We use this to upload the media to our servers for further processing. This was easy with ALAsset: ALAssetRepresentation *rep = [asset defaultRepresentation]; self.originalVideo = rep.url; But I'm just not seeing this ability in PHAsset. I guess I can call: imageManager.requestImageDataForAsset and then write it out to a temp spot in the file

NSURL from PHAsset

牧云@^-^@ 提交于 2019-11-26 10:56:18
问题 I\'m converting our app over to use the Photos Framework of iOS8, the ALAsset framework is clearly a second class citizen under iOS8. I\'m having a problem is that our architecture really wants an NSURL that represents the location of the media on \"disk.\" We use this to upload the media to our servers for further processing. This was easy with ALAsset: ALAssetRepresentation *rep = [asset defaultRepresentation]; self.originalVideo = rep.url; But I\'m just not seeing this ability in PHAsset.