Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Self-Destructing Message iPhone App Capturing Photo and Video Using UIImagePickerController Uploading the File and Message

Problem with sending image

hi guys,

ive created the send button, i connected it with parse com.

now i can send movie, but not a image as message...i think it has to do with image code...but i couldnt find;

- (IBAction)send:(id)sender {
    if (self.image == nil && [self.videoFilePath length] ==0) {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Try again" message:@"Please capture or select photo or video to share" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
        [alertView show];
        [self presentViewController:self.imagePicker animated:NO completion:nil];
    }

    else {
        [self uploadMessage];
        self.image = nil;
        [self reset];
        [self.tabBarController setSelectedIndex:0];

    }


}```

I think I found the problem, self.image = nil ;

changed into ; [self image];

but still I cant send an image after selecting friends....

2nd change (now it resets after uploading the message properly, but i still cant send a image, while sending a movie is not error causing,,,??!!)

else { [self uploadMessage]; [self reset]; [self.tabBarController setSelectedIndex:0];

}

}

1 Answer

I found the problem, I used the different method in imagePickerController.

this is the right one; [info objectForKey:UIImagePickerControllerMediaType];