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

Cancel action crashing. Any help?

#pragma mark - IBAction

- (IBAction)cancel:(id)sender {
    [self reset];
    [self.tabBarController setSelectedIndex:0];
}

- (IBAction)send:(id)sender {
    if (self.image == nil && [self.videoFilePath length] == 0) {
        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Oops!" message:@"Please capture a moment!" preferredStyle:UIAlertControllerStyleAlert];

        UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
        [alertController addAction:ok];

        [self presentViewController:alertController animated:YES completion:nil];
        [self presentViewController:self.imagePicker animated:NO completion:nil];
    } else {
        [self uploadMessage];
        [self.tabBarController setSelectedIndex:0];
    }
}

- (void)reset {
    self.image = nil;
    self.videoFilePath = nil;
    [self.recipients removeAllObjects];

Error msg. =

[CameraViewController Cancel:]: unrecognized selector sent to instance 0x7fca92dbecc0 Ribbit[54793:8018853] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CameraViewController Cancel:]: unrecognized selector sent to instance 0x7fca92dbecc0'

Found the answer if anybody else has this problem. I deleted the cancel button and made another one. I changed the type to UIBarButtonItem

Found the answer if anybody else has this problem. I deleted the cancel button and made another one. I changed the type to UIBarButtonItem

1 Answer

Nehemiah, here is a full template for the social network application: Click Here.