alassetslibrary

How to get all photos moment wise using ALAssetLibrary in ios7?

强颜欢笑 提交于 2019-12-01 22:31:56
I have problem to get photos in moment wise like apple iphone have in ios8. I have implemented for ios8 using PHAsset and Photos.framework. Now, when i run same code in ios7 device then it returns nothing. So, i go with ALAssetLibrary to get photos. Using ALAssetLibrary i also got all photos but that are like albums wise photos. and also using this ALAssetLibrary i cannot get album creation date not its location name, as i have to show this to data on my each section's header. My code for fetching photos in ios7 using ALAssetLibrary: _imagearray = [@[] mutableCopy]; __block NSMutableArray

iOS Create custom photo album in Photos (addAssetsGroupAlbumWithName under iOS 5?)

旧街凉风 提交于 2019-12-01 18:48:05
问题 I wanted to know if its anyhow possible to create your own photo album in the iDevice's photo library ? I know ALAsset's addAssetsGroupAlbumWithName:resultBlock:failureBlock: , but it only works in iOS >= 5.0 . Is there a method that could support at least 4.3 ? 回答1: Creating customs albums is only created under ios 5. It's not possible under ios 4. Even the official apple photo app does not have a feature to create albums in the device itself under ios 4. Under ios 4 the only way to create

Getting NSData from an NSURL

孤人 提交于 2019-12-01 14:25:52
I am trying to upload a photo from my app into a web service. The flow I am attempting to create is as follows: User takes photo with camera Photo is saved to camera roll under a custom album URL of the saved photo is given to my store Store attempts to upload the photo to a web service. I am trying to use NSData *data = [NSData dataWithContentsOfURL:[item assetURL]] where item is a model that contains the URL concerned. But this line is not producing a data when I log it even if it produces a URL: "assets-library://asset/asset.PNG?id=28DBC0AC-21FF-4560-A9D6-5F4BCA190BDB&ext=PNG" The code

iOS photo permissions to ask for second time

柔情痞子 提交于 2019-12-01 12:53:51
I am currently using alasset which asks for permission for first time. If want to pop permission second time or every time when user has blocked it, how it is possible. Daij-Djan That dialog isn't controlled by the app, so no API for that. You can reset things as a user in the settings app (IIRC) but no programmatic way. To get the current authorization status: [ALAssetsLibrary authorizationStatus]; (+ (ALAuthorizationStatus)authorizationStatus) Also, methods to get assets taking access error blocks, e.g.: - (void)assetForURL:(NSURL *)assetURL resultBlock:(ALAssetsLibraryAssetForURLResultBlock

Get the “retouched” image from ALAssetRepresentation

会有一股神秘感。 提交于 2019-12-01 05:32:24
问题 Given an ALAssetRepresentation , is it possible to get its full resolution retouched image? If I use the method fullResolutionImage I get the full resolution image, but unadjusted in any way. If I use the method fullScreenImage I get the retouched image, but reduced to an appropriate for displaying full screen . 回答1: It’s not that easy, but you can. Notice that this will also apply any cropping done by the user in the Photos.app: ALAssetRepresentation *representation = asset

NSURLSession and stream upload in background

痞子三分冷 提交于 2019-11-30 13:37:21
I have some problems with using NSURLSession to upload photos from Asset Library to the server. At first NSURLSession doesn't support streaming upload. I got an exception when trying to using that: @property (nonatomic, strong) NSURLSession *uploadSession; ... _uploadSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration backgroundSessionConfiguration:kUploadBackgroundURLSessionIdentifier] delegate:self delegateQueue:nil]; ... NSURLSessionUploadTask *task = [self.uploadSession uploadTaskWithStreamedRequest:URLRequest]; This is an exception: Terminating app due to uncaught

How to display all images from NSDocument directory

南笙酒味 提交于 2019-11-30 13:32:16
问题 First i selected images from photo library to ALAsset Library and after that i stored images in document directory from ALAsset library path. i am using this code to store images in document directory from ALAsset Library.... Its working perfect... Now i want to display all images which are stored in document directory in table view.. how can i do this??? can anybody help me?? Code for importing images from ALAsset Library to NSdocument directory for (int j=0; j<[assetArray count]; j++) {

Saving Video in an Album Created

故事扮演 提交于 2019-11-30 13:22:30
问题 i have created an album using this code in AppDelegate methode NSString *albumName=@"999Videos"; ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; [library addAssetsGroupAlbumWithName:albumName resultBlock:^(ALAssetsGroup *group) { NSLog(@"added album:%@", albumName); } failureBlock:^(NSError *error) { NSLog(@"error adding album"); }]; Now i want to save the recorded videos to this 999Videos album created.Not to the photosAlbum which i have done like this. ALAssetsLibrary *library =

What is the correct way to import & save Photos from iPhone Album?

偶尔善良 提交于 2019-11-30 10:52:13
问题 I am Importing Photos from the iPhone Album to the documents folder of my application. This is my code. for (int j=0; j<[assetArray count]; j++) { ALAsset *assest = [assetArray objectAtIndex:j]; CGImageRef imageRef = assest.defaultRepresentation.fullResolutionImage; UIImage *image = [UIImage imageWithCGImage:imageRef]; NSData *imageData = UIImageJPEGRepresentation(image); [imageData writeToFile:documentsPath atomically:YES]; } Its working fine but when I try to Import higher resolution Images

ALAssetsLibrary getting the path of a video and play it later

只谈情不闲聊 提交于 2019-11-30 10:31:41
Using below code I am able to get the video files in tableview. But I am unable to get the path to the video so that I would save it and use it later to play. - (void)viewDidLoad { [super viewDidLoad]; [activity startAnimating]; assets = [[NSMutableArray alloc] init]; library = [[ALAssetsLibrary alloc] init]; UIImage *viewImage; [library writeImageToSavedPhotosAlbum:[viewImage CGImage] orientation:(ALAssetOrientation)[viewImage imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){ if (error) { NSLog(@"error"); } else { NSLog(@"url %@", assetURL); } }]; [library