I want to open a Word file in my app's delegate function with
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
and by adding to my Info.plist
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>doc</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>AppIcon.icns</string>
<key>CFBundleTypeName</key>
<string>Microsoft doc</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.word.doc</string>
</array>
</dict>
</array>
When I open an email in Google Inbox app with a Word document attached I see my app in the Document Interaction Controller and a copy of the Word file is sent to the delegate function.
But when I open de Document Interaction Controller in the iOS Word app via tapping the "..." behind the Word file in the list of recent files and then: "share" > "send copy" > "send with another app" my app is NOT visible in the Document Interaction Controller.
What should I do more or different to see my app in the Document Interaction Controller of an iOS Word App to edit the Word file in my app?
It appears that you have to mention in the Info.plist that the LSItemContentTypes conforms to org.openxmlformats.wordprocessingml.document format
so the Info.plist will become:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>doc</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>AppIcon.icns</string>
<key>CFBundleTypeName</key>
<string>Microsoft Word</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.word.doc</string>
<string>org.openxmlformats.wordprocessingml.document</string>
</array>
</dict>
</array>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句