简体   繁体   English

检索保存到照片库的iPhone照片

[英]Retrieving an iPhone photo saved to the photo library

I am saving images to the photo library and would like to retrieve them dynamically to display in future launches of my app. 我正在将图像保存到照片库,并希望动态检索它们,以便在我的应用程序的未来发布中显示。 I use the WriteToSavedPhotosAlbum function, as below, but do not get any info to access the saved photo programmatically. 我使用WriteToSavedPhotosAlbum函数,如下所示,但没有获得任何信息以编程方式访问保存的照片。

UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);

Once saved, is there a way to retrieve the file name/id and load an image from the photo library at a later time? 保存后,有没有办法检索文件名/ ID并在以后从照片库加载图像?

You can't, unless the user picks the photo using the UIImagePickerController . 除非用户使用UIImagePickerController选择照片,否则你不能。 Check this related question 检查这个相关的问题

You just need to save them for yourself. 你只需要为自己保存它们。 Possibly in your app's documents or cache folder. 可能在您的应用程序的文档或缓存文件夹中。

As a side note, when you say: "display at launch", if you mean to replace the Default.png, that won't work. 作为旁注,当你说:“在发布时显示”,如果你的意思是替换Default.png,那将无效。

The launch image must be static and included in your app bundle. 启动图像必须是静态的,并包含在您的应用包中。

If not, disregard. 如果没有,请不要理会。

try this code segment make the necessay changes 尝试此代码段进行必要的更改

UIImagePickerController *picker=[[UIImagePickerController alloc] init]; UIImagePickerController * picker = [[UIImagePickerController alloc] init];

picker.delegate=pickerDelegate; picker.delegate = pickerDelegate;

picker.sourcetype=UIImagepickerControllerSourceTypePhtoLibrary; picker.sourcetype = UIImagepickerControllerSourceTypePhtoLibrary;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM