Must we have to download the remote file before using AirDrop?

432 Views Asked by At

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

1

There are 1 best solutions below

0
On

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.