简体   繁体   English

iPhone无法在iPhone上创建相册

[英]iPhone No Saved Photo Album created on iPhone

I am using iPhone 2.0 SDK. 我正在使用iPhone 2.0 SDK。 I used the API UIImageWriteToSavedPhotosAlbum to save an image. 我使用API​​ UIImageWriteToSavedPhotosAlbum保存图像。 A Saved Photos album gets created on the iPhone Simulator when I save an image but tested on the device the image gets added in the Camera Roll album. 当我保存图像但在将图像添加到“相机胶卷”相册中的设备上进行测试时,会在iPhone模拟器上创建一个“保存的照片”相册。 While debugging, no errors occur but the Saved Photos album is not created on the device. 调试时,不会发生任何错误,但不会在设备上创建“保存的照片”相册。

It's just different naming conventions between simulator (and I image iPod touch) and iPhone. 这是模拟器(和我为iPod touch拍摄的图像)和iPhone之间的不同命名约定。 Since the iPhone has a camera, the Saved Album is called "Camera Roll". 由于iPhone具有相机,因此“保存的相册”称为“相机胶卷”。 Since the simulator doesn't have a camera, the Saved Album is called "Saved Photos" (or whatever). 由于模拟器没有相机,因此“保存的相册”称为“保存的照片”(或其他名称)。

Using UIImageWriteToSavedPhotosAlbum() should write the photo to the appropriate album. 使用UIImageWriteToSavedPhotosAlbum()可以将照片写到适当的相册中。

If the image is being saved to Camera Roll on your iPhone, then your code is working properly. 如果将图像保存到iPhone上的Camera Roll,则您的代码正常工作。

Depending on your device you may have to use the photo library instead. 根据您的设备,您可能不得不使用照片库。 Try the following: 请尝试以下操作:

    UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

if ([UIImagePickerController isSourceTypeAvailable:sourceType] == NO)
    sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
if ([UIImagePickerController isSourceTypeAvailable:sourceType] == YES)
{
    // acquire image
}

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

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