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 trialMD Dragon
Courses Plus Student 7,854 PointsUIImageWriteToSavedPhotosAlbum(self.imagePicker, nil, nil, nil);
This method gives me warning and crashes my app
3 Answers
Vladimir Cezar
7,710 PointsCan you upload the project to a github account? I could take a look then.
MD Dragon
Courses Plus Student 7,854 PointsI have never done it. when I try to take picture with my iphone and click on use button the app crashes immediately
thanks for quick reply
Here is the code
´´´
-
(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString*)kUTTypeImage]) { // A photo was taken/selected! self.image = [info objectForKey:UIImagePickerControllerOriginalImage]; if (self.imagePicker.sourceType == UIImagePickerControllerSourceTypeCamera) { // Save the image! UIImageWriteToSavedPhotosAlbum(self.imagePicker, nil, nil, nil); <==== This line give me warning } [self dismissViewControllerAnimated:YES completion:nil]; } else { // A video was taken/selected! NSURL *imagePickerURL = [info objectForKey:UIImagePickerControllerMediaURL]; self.videoFilePath = [imagePickerURL path]; if (self.imagePicker.sourceType == UIImagePickerControllerSourceTypeCamera) { // Save the video! if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(self.videoFilePath)) { UISaveVideoAtPathToSavedPhotosAlbum(self.videoFilePath, nil, nil, nil); } } } [self dismissViewControllerAnimated:YES completion:nil]; }
´´´
Vladimir Cezar
7,710 PointsIt is really hard to bug fix without the whole project. Github will be the best way.
MD Dragon
Courses Plus Student 7,854 PointsI have never uploaded project on github, I'll try anyway. thanks for your time, appreciate it.
this method = (Deprecated in iOS 7.0.)
thumbnailImageAtTime:timeOption:
Deprecated in iOS 7.0
thumbnailImageAtTime:timeOption: Captures and returns a thumbnail image from the current movie. (Deprecated in iOS 7.0.)
I think they need to update the course.
Vladimir Cezar
7,710 PointsGithub can be intimidating at beginning, but don't be. Take a course here at Treehouse on how to use git. Believe me, it is a skill you will use over and over. All the best.