在我的应用程序中,我需要从一个设备发送一些自定义数据文件到另一个设备,并且我正在尝试使用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];
addAttachmentData:typeIdentifier:filename:
? - StuartM