alasset

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

How can I get image created date time or last modified date time from iOS Photos (like camera roll)?

匆匆过客 提交于 2019-11-30 10:14:33
I am a new guy to iOS. Recently, I am developing an iOS application need to check image (in iOS Photos ) created date time and modified date time to sort these images by time. I used ALAssetsLibrary to enumerate all images, i can get following attributes of each image: image file name, image asset url (within it, i can get image file extension and unique asset id). But could someone tell me how to get the image file created date time and last modified date time? Thanks very much. You can retrieve the creation date of the asset using the ALAssetPropertyDate property: ALAsset* asset; ... NSDate*

Upload ALAsset URL images to the server

荒凉一梦 提交于 2019-11-30 07:42:15
问题 I am trying to access iPhone's photo album photo images through ALAssetsLibrary and upload(send) the images to my server. I am being successful accessing the photo album and get the asset URL of each images, via the following code: - (void)viewDidLoad { [super viewDidLoad]; void (^assetEnumerator)(struct ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) { if(result != NULL) { NSLog(@"See Asset: %@", result); [assets addObject:result]; // Here storing the asset

Getting the path of an ALAsset

别来无恙 提交于 2019-11-30 02:12:51
How can I get the path of each item in an array of ALAssets? I would like to get the images so that I can add them to an email e.g. NSString *path = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"png"]; NSData *myData = [NSData dataWithContentsOfFile:path]; [mailViewController addAttachmentData:myData mimeType:@"image/png" fileName:@"sample"]; How can this be done? Assuming you already have access to an array of ALAsset objects, you can retrieve their URL like this: someAsset.defaultRepresentation.url chilitechno.com Assuming you have the Asset URL, such as assets-library://asset

How to save video from assets url

蹲街弑〆低调 提交于 2019-11-30 01:39:26
I want to save video to my app document from asset url. My asset url is as follows:- "assets-library://asset/asset.MOV?id=1000000394&ext=MOV" I tried this:- NSString *str=@"assets-library://asset/asset.MOV?id=1000000394&ext=MOV"; NSData *videoData = [NSData dataWithContentsOfURL:[NSURL URLWithString:str]]; [videoData writeToFile:mypath atomically:YES]; but on the second line [NSData dataWithContentsOfURL:[NSURL URLWithString:str]] i got program crash with this reason:- Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL length]: unrecognized selector sent

How to get a ALAssetRepresentation of a shared photostream ALAsset?

你。 提交于 2019-11-29 21:48:38
When I try to access pictures from a photo stream, sometimes the [asset defaultRepresentation] method returns nil. According to the documentation this can occur if the asset is not (yet) available locally. This method returns nil for assets from a shared photo stream that are not yet available locally. If the asset becomes available in the future, an ALAssetsLibraryChangedNotification notification is posted. Once I view the photo in the Photos.app it becomes available for my app too, but obviously I'd like to have my app trigger the "download locally" event. I looked at the MyImagePicker

Wait for assetForURL blocks to be completed

和自甴很熟 提交于 2019-11-29 20:28:14
I would like to wait this code to be executed before to continue but as these blocks are called assynchronously I don't know how to do??? NSURL *asseturl; NSMutableArray *tmpListAsset = [[NSMutableArray alloc] init]; ALAssetsLibrary *library = [[[ALAssetsLibrary alloc] init] autorelease]; NSMutableArray *objectsToRemove = [[NSMutableArray alloc] init]; for (NSDictionary *dico in assetsList) { asseturl = [NSURL URLWithString:[dico objectForKey:@"assetUrl"]]; NSLog(@"asset url %@", asseturl); // Try to load asset at mediaURL [library assetForURL:asseturl resultBlock:^(ALAsset *asset) { // If

How to get a correctly rotated UIImage from an ALAssetRepresentation?

a 夏天 提交于 2019-11-29 11:33:03
I’m trying to get a correctly rotated UIImage from an ALAssetRepresentation using the fullScreenImage method. I have several testing photos shot in various device orientations; the photos show up correctly in the Photos app. The documentation for fullScreenImage says: In iOS 5 and later, this method returns a fully cropped, rotated, and adjusted image—exactly as a user would see in Photos or in the image picker. To create a correctly-rotated UIImage object from the CGImage , you use imageWithCGImage:scale:orientation: or initWithCGImage:scale:orientation: , passing the values of orientation

How to save video from assets url

僤鯓⒐⒋嵵緔 提交于 2019-11-28 22:35:29
问题 I want to save video to my app document from asset url. My asset url is as follows:- "assets-library://asset/asset.MOV?id=1000000394&ext=MOV" I tried this:- NSString *str=@"assets-library://asset/asset.MOV?id=1000000394&ext=MOV"; NSData *videoData = [NSData dataWithContentsOfURL:[NSURL URLWithString:str]]; [videoData writeToFile:mypath atomically:YES]; but on the second line [NSData dataWithContentsOfURL:[NSURL URLWithString:str]] i got program crash with this reason:- Terminating app due to

ALAssetsLibrary assetForURL: always returning nil for photos in “My Photo Stream” in iOS 8.1

浪子不回头ぞ 提交于 2019-11-28 17:53:50
This code worked fine in iOS 7 but in iOS 8.1 all assets located in the "My Photo Stream" album are nil from within the result block. (The failureBlock is not called.) Regular albums and shared albums work just fine. I tried the accepted answer from: Error trying to assigning __block ALAsset from inside assetForURL:resultBlock: That is, I'm holding a reference to an ALAssetsLibrary object, listening for the ALAssetsLibraryChangedNotification event (which doesn't happen btw, but oh well.) I made sure my app has permission to access photos, I'm on wi-fi, I see the photos' thumbnails just fine in