我想从 pdf 页面在我的应用程序中打开 pdf 文件,
但我没有在我的应用程序中打开 pdf 的任何选项。
这是我的 info.plist 文件
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeIconFiles</key>
<string>Icon.png</string>
<key>LSItemContentTypes</key>
<string>com.neosofttech.pdf</string>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.pdf</string>
</array>
<key>UTTypeDescription</key>
<string>PDFReader File</string>
<key>UTTypeIdentifier</key>
<string>com.neosofttech.pdf</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>pdf</string>
</dict>
</dict>
请告诉我哪里错了,我如何在我的应用程序中打开pdf文件。
我假设您正在尝试根据此处的 plist 从邮件中打开附件。由于您不拥有 PDF 文件类型,因此无法将其声明为导出类型。您只需将其声明为受支持的文档类型即可。
例如:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
</array>
您可以找到所有系统提供的内容类型的列表here http://developer.apple.com/mac/library/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html or in UTCoreTypes.h
.
当有人打开 PDF 文件并选择您的应用程序时,该文件将被复制到Inbox
你的子目录Documents
您的应用程序沙箱中的文件夹。然后您的应用程序将在您的应用程序委托中打开application:didFinishLaunchingWithOptions:
your launchOptions
字典将包含一个UIApplicationLaunchOptionsURLKey
键指定沙箱中您随后可以使用的文件的 URL。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)