我想从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>
Run Code Online (Sandbox Code Playgroud)
请告诉我这里我错在哪里,如何在我的应用程序中打开pdf文件.
Ash*_*ark 50
我假设您正在尝试根据您的plist在Mail中打开附件.由于您不拥有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>
Run Code Online (Sandbox Code Playgroud)
您可以在此处或在其中找到所有系统提供的内容类型的列表UTCoreTypes.h.
当有人打开PDF文件并选择您的应用程序时,该文件将被复制到应用程序沙箱中文件夹的Inbox子目录中Documents.然后,您的应用程序将被打开,并且在您的应用程序委托中,application:didFinishLaunchingWithOptions:您的launchOptions字典将包含一个UIApplicationLaunchOptionsURLKey密钥,用于指定沙箱中您可以使用的文件的URL.
| 归档时间: |
|
| 查看次数: |
16652 次 |
| 最近记录: |