UIActivityViewController 中缺少 Airdrop 选项
Airdrop option missing in UIActivityViewController
出于某种原因,当我在我的应用程序中使用 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 发送内容,项目需要是 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.
出于某种原因,当我在我的应用程序中使用 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 发送内容,项目需要是 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.