0

I am adding the video file to iphone simulator path, but it is not showing the video file in gallery. How can i add the video file to simulator please guide.

Below is code for picking the video from gallery.

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ( [mediaType isEqualToString:@"public.movie" ])
{
   // NSLog(@"Picked a movie at URL %@",  [info objectForKey:UIImagePickerControllerMediaURL]);
   // NSURL *url =  [info objectForKey:UIImagePickerControllerMediaURL];
   // NSLog(@"> %@", [url absoluteString]);

    if (CFStringCompare ((__bridge CFStringRef) mediaType, kUTTypeMovie, 0)
        == kCFCompareEqualTo)
    {

        //NSString *moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];

        // NSLog(@"%@",moviePath);

        NSURL *videoUrl=(NSURL*)[info objectForKey:UIImagePickerControllerMediaURL];
        NSData *webData = [NSData dataWithContentsOfURL:videoUrl];
        [self post:webData];

        if([profile isEqualToString:@"friend"])
        {
            [self callServerFriend];
        }
        if([profile isEqualToString:@"public"])
        {
            [self callServerPublic];
        }
    }
}
}
iPhone 7
  • 1,731
  • 1
  • 27
  • 63
  • duplicate of this [http://stackoverflow.com/questions/6370945/how-to-add-video-to-iphone-simulator](http://stackoverflow.com/questions/6370945/how-to-add-video-to-iphone-simulator) – Bhavin_m Jul 08 '13 at 09:41
  • How you add video and how you get the video ? show your code – SAMIR RATHOD Jul 08 '13 at 09:55
  • @SAMIRRATHOD I am not adding video programmatically, i want to take video from iphone gallery or simulator gallery then upload. I have the uploading code but not have the video in gallery to pick. – iPhone 7 Jul 08 '13 at 09:58

1 Answers1

4

follow this step :

1) Drag your video on simulator.
2) Then it play the video on safari.
3) now click on Done button.
4) Then click on MoveTo Button.

enter image description here

5) and last just click on saveToCameraroll.

enter image description here

now the video is available on your Photo Library of Simulator.

SAMIR RATHOD
  • 3,512
  • 1
  • 20
  • 45