在我的应用程序中,我需要将一些自定义数据文件从一台设备发送到另一台设备,我正在尝试使用 Mail、iMessage/Message 和 Airdrop 来做到这一点。
这适用于 Mail 和 Airdrop,但适用于 iMessage,它运行良好,但在接收端,我无法打开文件。它只是不允许我用它做任何事情。
有任何想法吗??
这是我的文档类型的样子:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>abc.png</string>
<key>CFBundleTypeName</key>
<string>ABC Custom Data type</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>Handler Rank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.company.abc.wd</string>
</array>
</dict>
</array>
这就是我发送数据的方式:
NSMutableDictionary * dict = [NSMutableDictionary dictionary];
[dict setObject:currentDataSet forKey:@"actualData"];
NSData * meetingData = [NSKeyedArchiver archivedDataWithRootObject:dict];
Meeting * dataItem = [[Meeting alloc]initWithData:meetingData
type:@"com.abc.xyz.wd" subject:@"Meeting"
previewImage:[UIImage imageNamed:@"appIcon.png"]];
UIActivityViewController * activityController =
[[UIActivityViewController alloc]initWithActivityItems:@[dataItem]
applicationActivities:nil];
activityController.excludedActivityTypes =
@[UIActivityTypePostToTwitter, UIActivityTypePostToWeibo];
[self presentViewController:activityController animated:YES completion:nil];