title: iOS 8 app extension get image from safari
body: <p>Im using app extension share on my app,</p>
  
  <p>is working fine for giving me back the url and "message" for the sharing,
  but my image appear as nil when logged</p>
  
  <pre><code>@interface ShareViewController ()
  @property (nonatomic, strong)__block NSString *urlString;
  @property (nonatomic, strong)__block UIImage *photo;
  @property (nonatomic, strong)NSString *msg;
  @end
  
  @implementation ShareViewController
  
  - (BOOL)isContentValid {
      // Do validation of contentText and/or NSExtensionContext attachments here
      return YES;
  }
  
  - (void)viewDidLoad{
  
      [super viewDidLoad];
  
      //Get msg
      NSExtensionContext *myExtensionContext = [self extensionContext];
      NSArray *inputItems = [myExtensionContext inputItems];
      for(NSExtensionItem* item in inputItems){
          self.msg = [NSString stringWithFormat:@"%@", [item.attributedContentText string]];
      }
  
      // get url
      NSExtensionItem *item = self.extensionContext.inputItems.firstObject;
      NSItemProvider *itemProvider = item.attachments.firstObject;
  
      if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeURL]) {
          [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeURL options:nil completionHandler:^(NSURL *url, NSError *error) {
              self.urlString = [NSString stringWithFormat:@"%@",url.absoluteString];
          }];
      }
  
  
      //img
      if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeImage]) {
          [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeImage options:nil completionHandler:^(UIImage *image, NSError *error) {
              self.photo = image;
          }];
      }
  
  }
  
  - (void)didSelectPost {
      // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
  
      NSLog(@"big fat fella");
      NSLog(@"msg: %@", self.msg);
      NSLog(@"url %@:", self.urlString);
      NSLog(@"im %@:", self.photo);
  
      // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.
      [self.extensionContext completeRequestReturningItems:@[] completionHandler:nil];
  }
  </code></pre>
  
  <p>so please note im getting url and message on didSelectPost, but image shows as null,</p>
  
  <p>how to get image?
  thx!</p>