简体   繁体   中英

iPhone No Saved Photo Album created on iPhone

I am using iPhone 2.0 SDK. I used the API UIImageWriteToSavedPhotosAlbum to save an image. 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. 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. Since the iPhone has a camera, the Saved Album is called "Camera Roll". 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.

If the image is being saved to Camera Roll on your iPhone, then your code is working properly.

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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