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

''Saving the Media'' lesson - videoFilePath issue - CGPathRef?

Hi guys,

In the video "Saving the media" , Ben uses

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

to get the videos path - where path returns a string.

But when I use the same line of code i get an issue:

Issue: Implicit conversion of C pointer type 'CGPathRef' (aka 'const struct CGPath *) to Objective-C pointer type 'NSString *' requires a bridged cast

Also, path is no longer of type NSString, its now changed to CGPathRef (maybe an Xcode 5 change?)

Im testing in the simulator because i dont have an iphone as of yet, so Im wondering will this be an issue in the future when I use it on a device.

Thanks guys!!

2 Answers

Alex Hedley
Alex Hedley
16,381 Points

I had the same issue: https://teamtreehouse.com/forum/saving-the-media-build-a-selfdestructing-message-iphone-app

Xcode5 indeed.

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

Forum Search: https://teamtreehouse.com/forum/search?query=+Saving+the+media

Thanks Alex, I searched the forum for the question prior to asking but got no relevant result...no idea what search terms I was using.

Sorry for the duplicate.

Alex Hedley
Alex Hedley
16,381 Points

No problem, I did exactly the same and got help from Patrick, hope it helps :)

Thanks! Stopped me in my tracks as well.