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
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

UIImageWriteToSavedPhotoAlbum problems!

artemisartemis Posts: 16Registered Users
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
    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
    artemis;220610 said:
    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
    artemis;220610 said:
    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
Sign In or Register to comment.