大家好。
我逐行学习了这两个教程,尝试将我的应用程序关联到 csv 文件(电子邮件应用程序附件),但是在我将这些更改添加到我的应用程序的 plist 文件之后,然后构建我的应用程序并运行它设备(iPhone 4,iOS 7.0.4),没有任何反应,我的意思是当我点击电子邮件中的 .csv 文件时,我的应用程序仍然没有出现在打开的可用应用程序列表中,我只是不知道我在哪里做错了,或者 iOS 7 有不同的方式来做这件事?
这是我的 plist 更改(教程后添加的新条目)的样子:
这是应用程序设置屏幕:
这是 xml 版本:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>CSV Document</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string></string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeDescription</key>
<string>CSV Document</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeIdentifier</key>
<string>Damian-s.${PRODUCT_NAME:rfc1034identifier}</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>csv</string>
<key>public.mime-type</key>
<string>application/inventorytodo</string>
</dict>
</dict>
</array>
最佳答案
您在 CFBundleDocumentTypes
定义中缺少 UTI 类型:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>CSV Document</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string></string>
</array>
</dict>
</array>
应该是:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>CSV Document</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>Damian-s.${PRODUCT_NAME:rfc1034identifier}</string>
</array>
</dict>
</array>
关于ios - 如何在 iOS 7 中将 CSV 文件关联到我的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22967013/