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

Alex Hedley
Alex Hedley
16,381 Points

Saving the Media [Build a Self-Destructing Message iPhone App]

Hi,

I'm getting the following error when adding code to the

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
...
}


self.videoFilePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];

image1 Image 1 Link

Image2 Image 2 Link

iOS Development > Build a Self-Destructing Message iPhone App > Capturing Photo and Video Using UIImagePickerController > Saving the Media

Course Link Link

(Edit: I'm using XCode5-DP2, deployment target 6.1 but iOS SDK 7.0)

2 Answers

I had the same issue. Ben seems to think it is a bug in the SDK beta. What is happening is that the path method that is being called is the wrong method. Split the method calls up and put them on two lines and everything will work fine.

Take a look at my thread from last week. https://teamtreehouse.com/forum/error-when-setting-videofilepath-in-saving-the-media-chapter-of-build-a-selfdestructing-messaging-app

Alex Hedley
Alex Hedley
16,381 Points

Thanks Patrick, I'll add the following:

NSURL *imagePickerURL = [info objectForKey:UIImagePickerControllerMediaURL];
self.videoFilePath = [imagePickerURL path];

Hi Patrick, do you get cloud code error when sending image to parse? Can you take a look at my thread:

https://teamtreehouse.com/forum/invalid-type-for-key-file

I haven't run through that course just yet, but it looks like that method's expecting a string and getting a pointer to an object type. I'd look and see if maybe you're handing it the wrong key there?

Oh, and I meant to say, but Ben Jakuben will be the best person to help out here. HALP BEN, you're our only hope!

Help

Alex Hedley
Alex Hedley
16,381 Points

That's awesome, thanks Alan :)

The sample code works fine so think I've made a goof somewhere, just looking about for any obv mistakes but thought I'd post here too.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Alan Johnson, I think you need to do a Quick Tip on how to find the perfect animated gif. :smile: