CFBundleDocumentType在myproject-Info.plist文件中不起作用

我正在尝试在ionic framework中构build一个应用程序。

我正在尝试构build这个function,就像当我点击图库中的照片并点击共享时,一个共享平台将打开。 我想在这里展示我的应用程序。

我在plist文件中做了一些修改

这里是我的plist文件的代码

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleDisplayName</key> <string>${PRODUCT_NAME}</string> <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>public.jpeg</string> <key>CFBundleTypeRole</key> <string>Editor</string> <key>LSHandlerRank</key> <string>Owner</string> <key>LSItemContentTypes</key> <array> <string>public.jpeg</string> </array> </dict> </array> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIconFile</key> <string>icon.png</string> <key>CFBundleIcons</key> <dict> <key>CFBundlePrimaryIcon</key> <dict> <key>CFBundleIconFiles</key> <array> <string>icon-40</string> <string>icon-small</string> <string>icon-60</string> <string>icon.png</string> <string>icon@2x</string> <string>icon-72</string> <string>icon-72@2x</string> </array> <key>UIPrerenderedIcon</key> <false/> </dict> </dict> <key>CFBundleIcons~ipad</key> <dict> <key>CFBundlePrimaryIcon</key> <dict> <key>CFBundleIconFiles</key> <array> <string>icon-small</string> <string>icon-40</string> <string>icon-50</string> <string>icon-76</string> <string>icon-60</string> <string>icon</string> <string>icon@2x</string> <string>icon-72</string> <string>icon-72@2x</string> </array> <key>UIPrerenderedIcon</key> <false/> </dict> </dict> <key>CFBundleIdentifier</key> <string>com.ionicframework.hitutest948556</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>${PRODUCT_NAME}</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>0.0.1</string> <key>CFBundleShortVersionString</key> <string>0.0.1</string> <key>LSRequiresIPhoneOS</key> <true/> <key>NSMainNibFile</key> <string></string> <key>NSMainNibFile~ipad</key> <string></string> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UILaunchImages</key> <array> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{320, 480}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default</string> <key>UILaunchImageOrientation</key> <string>Landscape</string> <key>UILaunchImageSize</key> <string>{320, 480}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default-568h</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{320, 568}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default-568h</string> <key>UILaunchImageOrientation</key> <string>Landscape</string> <key>UILaunchImageSize</key> <string>{320, 568}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default-667h</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{375, 667}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default-667h</string> <key>UILaunchImageOrientation</key> <string>Landscape</string> <key>UILaunchImageSize</key> <string>{375, 667}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default-736h</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{414, 736}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default-Landscape-736h</string> <key>UILaunchImageOrientation</key> <string>Landscape</string> <key>UILaunchImageSize</key> <string>{414, 736}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default-Portrait</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{768, 1024}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>Default-Landscape</string> <key>UILaunchImageOrientation</key> <string>Landscape</string> <key>UILaunchImageSize</key> <string>{768, 1024}</string> </dict> </array> </dict> </plist> 

我已经添加的部分

  <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>public.jpeg</string> <key>CFBundleTypeRole</key> <string>Editor</string> <key>LSHandlerRank</key> <string>Owner</string> <key>LSItemContentTypes</key> <array> <string>public.jpeg</string> </array> </dict> </array> 

任何相同的build议。 至于我仍然无法将myapp看成共享窗格

谢谢

有几件事缺失/错误:

  • CFBundTypeIconFiles:我很喜欢你需要指定你的应用程序出现的图标
  • CFBundleTypeName:你把你的应用程序的名字放在这里
  • CFBundleTypeRole:我想你想在这里“查看器”
  • LSHandlerRank:我认为你想要“替代”在这里(不知道你可以是像“public.jpeg”的内容types的东西)

这是一个注册你的应用程序的例子。 它经过testing,适用于所有types的数据 。 从那里开始工作,只针对public.jpeg:

 <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeIconFiles</key> <array> <string>Icon-22x29.png</string> <string>Icon-44x58.png</string> <string>Icon-64x64.png</string> <string>Icon-320x320.png</string> </array> <key>CFBundleTypeName</key> <string>My App</string> <key>CFBundleTypeRole</key> <string>Viewer</string> <key>LSHandlerRank</key> <string>Alternate</string> <key>LSItemContentTypes</key> <array> <string>public.data</string> </array> </dict> </array> 

UIFileSharingEnabled设置为YES 。 你错过了把它放在plist中。

希望这将解决您的问题。