【发布时间】:2015-08-19 04:00:52
【问题描述】:
我是 iOS 开发新手。我设计了一个自定义附件以通过邮件发送。当我收到邮件中的附件时,我想在我的应用程序中打开附件。 这是我的 info.plist
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>pvt file</string>
<key>UTTypeIdentifier</key>
<string>com.pryvateBeta.crypt.pvt</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>pvt</string>
</dict>
</dict>
</array>
<key>CFBundleDocumentsType</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>pvt file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.pryvateBeta.crypt.pvt</string>
</array>
</dict>
</array>
这是我的 Appdelegate
func application(application: UIApplication, openURL Url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
let encrypteddata = NSData(contentsOfURL: Url)
return true
}
我之前在LINK 中问过这个问题。这可能是这个QUESTION 的副本。但是,我没有得到解决方案,也找不到问题所在。
我的代码中缺少什么?任何帮助表示赞赏
【问题讨论】:
-
使用应用程序目标编辑器的信息选项卡设置您的文档类型和导出的 UTI。它将正确设置 Info.plist。
-
plist 中是否缺少任何内容?这样我就可以按照你提到的方式添加它@matt
标签: ios swift email-attachments uti