Get video from share extension from photos like whatsapp
<p>Im trying this code to get video from from share extension from photos app but its returns <code>nil</code></p>

<p><a href="https://i.stack.imgur.com/w2LvS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w2LvS.jpg" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/KShV3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KShV3.jpg" alt="enter image description here"></a></p>

<pre><code>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
            }];
       }
    }
}
</code></pre>

<p>output </p>

<p>Found url of video</p>

<p>url = nil</p>

<p>****EDIT****</p>

<p>Its work fine in simulator but not in device.</p>