由于某种原因,当我从我的应用程序使用ActivityViewController时,我没有得到使用Airdrop共享的选项。如果我在Chrome中使用它,我会选择:
这是我正在使用的代码:
NSMutableArray * items = [NSMutableArray new];
[items addObject:@"text for share"];
[items addObject:[UIImage imageNamed:@"image"]];
NSArray *activityItems = [NSArray arrayWithArray:items];
UIActivityViewController *activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:nil];
[self presentViewController:activityViewController animated:YES completion:^{
.....
}];
但我只能得到这个:
如何添加Airdrop选项?
答案 0 :(得分:2)
为了能够通过AirDrop发送内容,该项目需要是一个URL。我找不到官方文档,但是在Apple AirDrop Example中它说明了:
URLs can be used as a simple way to transfer information between devices. Apps can easily parse a received URL to determine what action to take. After an app registers a URL scheme (including custom schemes), the system will know to launch that app when a URL of that type is received.