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

Take Photo-AVFoundation Weird Issue

Hi everyone,

I have an interesting problem with the app that i am trying to build.I have a root viewcontroller where the camera shows up (using avfoundation) and an image view that will present the still image taken with the camera. I have also added a button that will perform a segue to a second viewcontroller. When i am testing the "app" on the phone, after i open it, it shows the camera and obviously the image view is empty since no photo was taken . However, if i click the button that sends me to the second viewcontroller and then i go back to the root viewcontroller there is a photo taken that is shown in the image view and it seems it was taken exactly when i tapped the button that performs the show-segue. Anyone has an ideea about what the issue might be? PS: I am 100% sure the segue button is not related in any way with the take photo method Thank you !

Russell Warwick
Russell Warwick
1,601 Points

Is this a custom camera view that you have created ?

1 Answer

Russell Warwick
Russell Warwick
1,601 Points

Is this a custom camera view. If so just check that when you load the camera view this is only done in view did load. Also check that when you return from the second view controller check that in the view will appear that you say that the imageView that has the photo of what ever is on it is hidden. I was stuck on this for ages and in the end it was very simple fix :)