“imagePickerController:didFinishPickingMediaWithInfo:” “UIImagePickerControllerMediaURL” key strange behavior in info dictionary

In "imagePickerController:didFinishPickingMediaWithInfo:" the info dictionary sometimes doesn't have the key "UIImagePickerControllerMediaURL". Sometimes it does have. I tried cleaning the targets but that didn't help. Also, the workflow is always the same: I follow the same steps and choose the same video file from library. Sometime info dictionary has "UIImagePickerControllerMediaURL" key in it and sometime "UIImagePickerControllerMediaURL" is absent in the info dictionary itself for the same file. Could not understand it. Can somebody help ? Thanks :)

This is my NSLog of info dictionary when i select video/movie from photos library :

info dict = {
    UIImagePickerControllerMediaType = "public.movie";
    UIImagePickerControllerReferenceURL = "assets-library://asset/asset.MOV?id=1000000466&ext=MOV";
} 

Answers


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

{ 
    NSMutableDictionary *infoDict = [[NSMutableDictionary alloc]init];

    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];

    if ([mediaType isEqualToString:@"public.image"]){

        UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"" message:@"You Select a image Please select Movie" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

        [myAlertView show];

        [myAlertView release];

    }

    else if ([mediaType isEqualToString:@"public.movie"]){

        NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];

        mAppDelegate.uploadType = @"Video";

        NSData *webData = [NSData dataWithContentsOfURL:videoURL];

        [infoDict setValue:webData forKey:@"VideoUrl"];

        [infoDict setValue:[[mAppDelegate.userInfoArray objectAtIndex:1]valueForKey:@"user_id"] forKey:@"user_id"];

        [[WakeUpParsing sharedInstance] assignSender:self];

        [[WakeUpParsing sharedInstance] startParsingForVedioUploade:infoDict];

    }

    [picker dismissModalViewControllerAnimated:YES];

    [infoDict release];

}


- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker

{

    // Dismiss the image selection and close the program
    [[picker parentViewController] dismissModalViewControllerAnimated:YES];

}

It happen when your account Video save on iCloud. When you choose video it will temporarily download from icloud and show to you so UIImagePickerControllerMediaURL will don't appear.


Need Your Help

Change SVG stroke on path with jQuery

javascript jquery html5 svg stroke

I've set my SVG image as the background of a div. Now I want to change the stroke of a specific path with jQuery every x seconds. I've seen an example (click me) where this is basically done.

JList is not displaying when DefaultListModel is changed using AddElement

java swing jscrollpane jlist defaultlistmodel

I am implementing a program for a Component Design course and am currently struggling with what should be simple use of a Jlist. The program draws shapes and should display them in a JList in a

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.