iOS how to use NSData and pasteboard

Hi There,

I’m trying to build a functionality which should pass an image element to the instagram app to use the element as a story backgroung.

I’m following several documentation including the official documentation from instagram, but I’m stuck with binding the code example from the documentation with the AppGyver interface.

So far I’m able to open the IG app with the urlScheme and I’m also to open the IG story page, but I’m not able to send the picture to the IG app.

What I don’t understand is how to interpretate the NSData and the pasteboard on iOS, I can’t find anything useful inside the community and the documentation of AppGyver and this lead me to think maybe this is not supported, but since I’m new to this, my hope is that I just don’t see it.

I’m following the below code example from “[Sharing to Stories - Instagram Platform - Documentation - Facebook for Developers](https://Instagram sharing to story)”:

- (void)shareBackgroundImage {
      [self backgroundImage:UIImagePNGRepresentation([UIImage imageNamed:@"backgroundImage"])];
}

- (void)backgroundImage:(NSData *)backgroundImage {

  // Verify app can open custom URL scheme, open if able
  NSURL *urlScheme = [NSURL URLWithString:@"instagram-stories://share?source_application=com.my.app"];
  if ([[UIApplication sharedApplication] canOpenURL:urlScheme]) {
  
        // Assign background image asset to pasteboard
        NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundImage" : backgroundImage}];
        NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
        // This call is iOS 10+, can use 'setItems' depending on what versions you support
        [[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
    
        [[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];
  } else {
      // Handle older app versions or app not installed case
  }
}

And this is what it looks like on the AppGyver app:



I wish someone could clarify a little bit, thanks