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 Presenting the UIImagePickerController (Camera View)

Error: Presenting ViewControllers on detached ViewControllers is discouraged... appears after I click on the camera icon

I've reviewed the video 3 times and my code appears to be correct. I'm using iOS 8 on Xcode 6. I've read everything on the internet and can't seem to find a solution. I would appreciate any help.

// Required init items to set up a camera self.imagePicker = [[UIImagePickerController alloc] init]; self.imagePicker.delegate = self; self.imagePicker.allowsEditing = NO; self.imagePicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:self.imagePicker.sourceType];

// Displays images choices from camera or from photo libray when device is not a camera
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
    self.imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
} else {
    self.imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}

// Present camera modally
[self presentViewController:self.imagePicker animated:NO completion:nil];

Never mind I found the problem. I had changed the return values from 0 to 1 in the table methods and that was causing the issue.

Darean Wong
Darean Wong
Courses Plus Student 4,186 Points

I changed both numberOfRowsInSection and numberOfSectionsInTableView but to no avail, it even crashed the app. You sure that's what you did to make the warning go away?

1 Answer

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