alasset

Getting the path of an ALAsset

大兔子大兔子 提交于 2020-01-20 17:10:24
问题 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? 回答1: Assuming you already have access to an array of ALAsset objects, you can retrieve their URL like this: someAsset

Getting the path of an ALAsset

旧城冷巷雨未停 提交于 2020-01-20 17:07:48
问题 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? 回答1: Assuming you already have access to an array of ALAsset objects, you can retrieve their URL like this: someAsset

Read images from a iphone album using ALAssetsLibrary

对着背影说爱祢 提交于 2020-01-13 10:58:39
问题 I am trying to write a method that read assets from a album I am getting all images from all album using ALAsset, my question is how can I customize this method to read images from myAlbum /** * This method is used to get all images from myAlbum * folder in device if getAlbumImages is set to 1 * else loads all images from devices library */ -(void)readImages:(int)getAlbumImages { imageArray = [[NSArray alloc] init]; mutableArray =[[NSMutableArray alloc]init]; NSMutableArray*

PHAsset (or ALAsset) cross-device identifier

偶尔善良 提交于 2020-01-13 10:24:10
问题 I am actually creating an iOS app, and want to store some details about Photo Library pictures in an SQLite database. I also would like to be able to share this data across the different devices the user has (imagine someone wanted to reorganize pictures on his iPhone, and wants to retrieve the same order in his iPad). I have searched across the Apple documentation, but did not find any PHAsset identifier that is shared across devices. I also tried to check if the PHImageFileURLKey ,

How can i avoid Location service in AlAssetLibrary? Can i retrieve files using AlAssetLibrary without using Location Service?

夙愿已清 提交于 2020-01-11 06:28:13
问题 i created a application to get images from iPhone photo Folder using ALAssetLibrary. Can i retrieve files using AlAssetLibrary without using Location Service? How can i avoid Location service in AlAssetLibrary? 回答1: Currently there is no way to access ALAssetLibrary without using location services. You have to use the, much more limited, UIImagePickerController to get around that problem. 回答2: The above answer is incorrect if you only need one image from the library. For example, if you are

How to enumerate all photos on iOS 8 using ALAssetsLibrary

廉价感情. 提交于 2020-01-02 03:13:10
问题 iOS 8 broke lots of apps by removing "Camera Roll" from the ALAssetsLibrary enumerating API. I know I can get all photos using the new Photos framework. But my app has a lot of code depending on ALAsset related classes and I need to keep iOS 7 support. Is there a way to enumerate all photos using ALAssetsLibary on iOS 8, without enumerating asset group first? 回答1: Apple just released 8.0.1 and listed this as a included fix. Might just be best to wait for that. From the 8.0.1 release notes:

Error trying to assigning __block ALAsset from inside assetForURL:resultBlock:

送分小仙女□ 提交于 2020-01-01 06:05:27
问题 I am trying to create a method that will return me a ALAsset for a given asset url. (I need upload the asset later and want to do it outside the result block with the result.) + (ALAsset*) assetForPhoto:(Photo*)photo { ALAssetsLibrary* library = [[[ALAssetsLibrary alloc] init] autorelease]; __block ALAsset* assetToReturn = nil; NSURL* url = [NSURL URLWithString:photo.assetUrl]; NSLog(@"assetForPhoto: %@[", url); [library assetForURL:url resultBlock:^(ALAsset *asset) { NSLog(@"asset: %@",

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

限于喜欢 提交于 2019-12-30 03:32:05
问题 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. 回答1: You can

Replace ALAsset object in iOS ALAssetsLibrary

此生再无相见时 提交于 2019-12-24 02:37:26
问题 I am developing an application that reads the geo location of an image and allows the user to modify this information and write this data back. I successfully read the data, manipulate and write to the library by using writeImageDataToSavedPhotosAlbum function. The problem is that instead updating the original image, it creates a new one. How could i replace or update that item ? [...] NSMutableDictionary *EXIFDictionary = [[[metadata objectForKey:(NSString *)kCGImagePropertyExifDictionary

UIImage from GRKPhoto using ALAsset

与世无争的帅哥 提交于 2019-12-23 12:27:30
问题 I'm using grabKit in order to allow users to import their Instagram, Facebook and local pictures to my app. The problem comes when the photo is local. In this case, I use a method that works when the user selects the photo. The standard code I found in order to do so is the following: - (void)picker:(GRKPickerViewController*)picker didSelectPhoto:(GRKPhoto *)photo{ [popover dismissPopoverAnimated:YES]; GRKImage *originalImage = [photo originalImage]; NSLog(@" the URL of the original image of