0

I am sending the remote file (for example: image file, pdf file ... ) to Airdrop. I have only the direct link of this file : http://example.com/xxx/png. Currently, I am doing something like below code

NSString *filePath = self downloadFileFromServerWithURL
NSURL *urlFilePath = [NSURL fileURLWithPath:filePath];
NSArray *Items     = [NSArray arrayWithObjects:
                                          [NSNumber numberWithFloat:indexPath.row],
                                          urlFilePath,nil];

UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:Items applicationActivities:[NSArray arrayWithObjects:xxx, yyy,nil];

[self presentViewController:activityViewController animated:YES completion:nil];

So, my question is, how can I share the remote file with Airdrop without downloading it before? I show a lot of iOS softwares can do that, like DropBox

Thank you

Nam Vu
  • 5,669
  • 7
  • 58
  • 90

1 Answers1

1

you should look into using a subclass of UIActivityItemProvider which will let you asynchronously get/generate the actual item to be shared. The AirDrop sample code has an example of this.

ccjensen
  • 4,578
  • 2
  • 23
  • 25