Хорошо, я это выяснил. Проблема с библиотекой активов заключается в том, что она дает вам все данные GEO изображения. Для пользователей, использующих ваше приложение, это означает, что они получат подсказку о том, что ваше приложение пытается получить доступ к своему местоположению. Infact все, что вы пытаетесь сделать, это позволить им выбрать несколько изображений из своего фотоальбома. Большинство пользователей будут отключены, думая, что это проблема пиратства. Лучший подход - использовать applis api для imagePickerController. Я знаю, что это позволяет вам выбирать один рисунок за раз, но если вы добавите следующий код, он позволит вам выбрать несколько изображений.
Способ, которым я занимаюсь, позволяет пользователям выбирать фотографии, которые они хотят, сохранять эти файлы в каталоге документов приложения, пока они не нажмут кнопку «Готово». Смотрите здесь мой пример кода, и, надеюсь, это сэкономит вам боль проходит через Assets Library
-(IBAction)selectExitingPicture
{
//Specially for fing iPAD
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];
popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[popoverController presentPopoverFromRect:CGRectMake(0.0, 0.0, 400.0, 300.0)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
//Done button on top
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
//NSLog(@"Inside navigationController ...");
if (!doneButton)
{
doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonItemStyleDone
target:self action:@selector(saveImagesDone:)];
}
viewController.navigationItem.rightBarButtonItem = doneButton;
}
- (IBAction)saveImagesDone:(id)sender
{
//NSLog(@"saveImagesDone ...");
[popoverController dismissPopoverAnimated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage : (UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
//DONT DISMISS
//[picker dismissModalViewControllerAnimated:YES];
//[popoverController dismissPopoverAnimated:YES];
IMAGE_COUNTER = IMAGE_COUNTER + 1;
imageView.image = image;
// Get the data for the image
NSData* imageData = UIImageJPEGRepresentation(image, 1.0);
// Give a name to the file
NSString* incrementedImgStr = [NSString stringWithFormat: @"UserCustomPotraitPic%d.jpg", IMAGE_COUNTER];
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsDirectory = [paths objectAtIndex:0];
// Now we get the full path to the file
NSString* fullPathToFile2 = [documentsDirectory stringByAppendingPathComponent:incrementedImgStr];
// and then we write it out
[imageData writeToFile:fullPathToFile2 atomically:NO];
}
// Теперь использовать этот код, чтобы добраться до выбранных пользователем изображений.Назовите это из любого места вы хотите в вашем коде
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask ,YES);
NSString* documentsPath = [paths objectAtIndex:0];
NSString* dataFile = [documentsPath stringByAppendingPathComponent:@"UserCustomPotraitPic1.jpg"];
NSData *potraitImgData = [NSData dataWithContentsOfFile:dataFile];
backgroundImagePotrait = [UIImage imageWithData:potraitImgData];
Преобразование его в ARC не сложно .. –