0

Im trying this code to get video from from share extension from photos app but its returns nil

enter image description here

enter image description here

NSString *videoTypeIdentifier = (NSString *)kUTTypeMPEG4;
for (NSExtensionItem *item in self.extensionContext.inputItems) 
{
    for (NSItemProvider *itemProvider in item.attachments) 
    {
       if ([itemProvider hasItemConformingToTypeIdentifier:videoTypeIdentifier]) 
       {
            NSLog(@"Found url of video"); // 
            [itemProvider loadItemForTypeIdentifier:videoTypeIdentifier
                                            options:nil
                                  completionHandler:^(NSURL *url, NSError *error)
            {
                    NSLog(@"url = %@",url);// its always nil
            }];
       }
    }
}

output

Found url of video

url = nil

****EDIT****

Its work fine in simulator but not in device.

Sudhir
  • 127
  • 1
  • 12

1 Answers1

0

After restarting xcode, now work on both device and simulator.

Sudhir
  • 127
  • 1
  • 12