Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

UIImageWriteToSavedPhotoAlbum problems!

artemisartemis Posts: 16Registered Users
edited December 2010 in iPhone SDK Development
I'm using the new SDK 4.0 and I am having problems with the UIImageWriteToSavedPhotosAlbum function....

I'm trying to save an image in an UIImageView into my camera roll in my phone. I'm running the Simulator at the moment though, as I don't have an iPhone ready for testing just yet.
 UIImage *myImage = [UIImage imageNamed:@"icon-72.png"];
UIImageWriteToSavedPhotosAlbum(myImage,self,@selector(image:didFinishSavingWithError:contextInfo);
....
...


-(void)image: (UIImage *)image didFinishSavingWithError: (NSError *)error contextInfo: (void *)contextInfo {

if(error) {
 NSLog(@"Error is:%@",[error description]; 
}
else....


The image exists and I can view it in my UIImageView, but every time I try to save it, it gives me an error:

2010-07-12 12:46:01.435 TestTapDisplay[27077:207] Error is: Error Domain=ALAssetsLibraryErrorDomain Code=-3310 "Data unavailable" UserInfo=0x593bf10 {NSLocalizedRecoverySuggestion=Launch the Photos application, NSLocalizedDescription=Data unavailable}

I'm at my wit's end, what on earth am I doing wrong?

artemis
Post edited by artemis on

Replies

  • artemisartemis Posts: 16Registered Users
    edited July 2010
    I've discovered the cause of the problem now. When I upgraded my SDK and iPhone simulator to 4.0, the new iPhone simulator does not have any photos in the photo album. Calling UIImageWriteToSavedPhotosAlbum does not create a new photo album and, failing to find one, it just gives a cryptic error "Data unavailable". I was able to create a photo album simply by dragging an image from my Mac into the iPhone simulator window, and then checking the Photos app to see that it is really there.

    After that, UIImageWriteToSavedPhotosAlbum works without a problem.

    artemis
  • jinhaogxyjinhaogxy Posts: 22Registered Users
    edited August 2010
    artemis wrote: »
    I've discovered the cause of the problem now. When I upgraded my SDK and iPhone simulator to 4.0, the new iPhone simulator does not have any photos in the photo album. Calling UIImageWriteToSavedPhotosAlbum does not create a new photo album and, failing to find one, it just gives a cryptic error "Data unavailable". I was able to create a photo album simply by dragging an image from my Mac into the iPhone simulator window, and then checking the Photos app to see that it is really there.

    After that, UIImageWriteToSavedPhotosAlbum works without a problem.

    artemis
    Thanks for you point out this issue, would you let me know how to create a new photo album in iphone4 if I can't save image with iPhone4, thanks a lot.
  • carolightcarolight Posts: 3New Users
    edited September 2010
    artemis wrote: »
    I was able to create a photo album simply by dragging an image from my Mac into the iPhone simulator window, and then checking the Photos app to see that it is really there.

    Thanks - I also had to do a iPhone Simulator > Reset Contents and Settings. Before doing that, I didn't have a Photo app on the simulator.
  • snyeahsnyeah Posts: 1New Users
    edited December 2010
Sign In or Register to comment.