Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSItemProvider to photo formats like uiimage or alasset

Tags:

ios8

How do I get the image from a NSItemProvider file? When I use -loadItemForTypeIdentifier:kUTTypeImage , I get a NSURL that looks like this

file:///var/mobile/Media/DCIM/103APPLE/IMG_3349.JPG

what can I do with it? Thanks!

TAGS: NSItemProvider NSExtensionItem ios share extensions

like image 299
Ted Avatar asked Mar 18 '23 13:03

Ted


1 Answers

simply use

[imageItemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeImage options:nil completionHandler:^(id item, NSError *error) {
        if (item)
        {
            NSData *data = [NSData dataWithContentsOfURL:item];
        }

do whatever you want with data

like image 105
user02620 Avatar answered Apr 02 '23 14:04

user02620