我无法让UIActivityViewController
附加使用UIDocument
创建的自定义文件类型。谁能帮忙?使用UIActivityViewController自定义文件类型
电子邮件具有完全没有附件,即使该文件的URL是否有效,并指向与.wki
扩展(我的自定义扩展)文件,通过的UIDocument
一个子类中创建。
代码发送电子邮件:为文档类型和导出UTI的
NSURL *url = self.entrySelected.fileURL;
NSArray *activityItems = @[url];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:nil];
信息-plist中设置有:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>MyApp Doc</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.stephencox.myApp.doc</string>
</array>
<key>LSTypeIsPackage</key>
<string>YES</string>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.apple.package</string>
</array>
<key>UTTypeDescription</key>
<string>MyApp Doc</string>
<key>UTTypeIdentifier</key>
<string>com.stephencox.myApp.doc</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>wki</string>
</array>
</dict>
</dict>
</array>
我看到同样的事情,有什么奇怪的是它工作了一段时间,然后停止工作,但我不知道是什么。 –
您是否找到了解决方案?我与我自己的文件扩展名“.wpt”有同样的问题。奇怪的是,如果我将文件名的扩展名更改为其他名称,那么它确实有效。但当然这不是一种选择。 – fishinear
我有一个类似的问题,在我的情况下试图附加一个“.momd”版本管理的对象模型包。我不知道问题是iOS不能完全处理文件包?根据Apple的文档(https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html),“LSTypeIsPackage”键仅适用于OS X. – pistachionut