iPhone No Saved Photo Album created on iPhone

2019-08-12 20:40发布

问题:

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.

回答1:

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.



回答2:

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
}