iPad apps for 6-8 years old kids : This is my latest iPad project called Oh Mommy - Musical Storybook.

Tuesday, February 28, 2012

iOS : Cannot Save to Photo Album

-(IBAction) saveToPhotoAlbum{
  NSString *saveMyPhoto=[NSHomeDirectory() 
  UIImage *saved=[UIImage imageWithContentsOfFile:saveMyPhoto]; 
  NSData *imageData = [NSData dataWithContentsOfFile:(NSString *)
  [imageData writeToFile:(NSString *)saved atomically:YES ];
  UIImageWriteToSavedPhotosAlbum(saved, self, @selector 
(image:didFinishSavingWithError:contextInfo:), nil);

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

    if (error)
        alert = [[UIAlertView alloc] initWithTitle:@"Error" 
                                           message:@"Unable to save image to Photo 
                                          delegate:self cancelButtonTitle:@"Ok" 
        alert = [[UIAlertView alloc] initWithTitle:@"Success" 
                                           message:@"Image saved to Photo Album." 
                                          delegate:self cancelButtonTitle:@"Ok" 
    [alert show];
    [alert release];

Anyone can help me to trouble shoot this iOS code will be much appreciated? 
I want to create a button that can save the current image using a button from 
the thumbnail display. But the real image is in the home xCode home directory

No comments:

Singing Book for Kids

Singing Book for Kids
ipad apps for kids