- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个拖放 NSView
,它应该接受与我在 plist
的 CFBundleDocumentTypes
键下列出的相同的文件类型和扩展名>。该应用接受 public.movie
类型未选取的任何类型的视频文件、文件夹和多个文件扩展名。
CFBundleDocumentTypes
的(相当长的)列表是:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Movies</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>public.movie</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>flv</string>
</array>
<key>CFBundleTypeName</key>
<string>Flash Video File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ram</string>
<string>rm</string>
<string>rmvb</string>
</array>
<key>CFBundleTypeName</key>
<string>RealPlayer Media Files</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>vob</string>
</array>
<key>CFBundleTypeName</key>
<string>VOB File (DVD Video)</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ogm</string>
</array>
<key>CFBundleTypeName</key>
<string>Ogg MPEG-4 Video File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ogv</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>video/ogg</string>
</array>
<key>CFBundleTypeName</key>
<string>Ogg Video File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>axv</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>video/annodex</string>
</array>
<key>CFBundleTypeName</key>
<string>Annodex Video File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>avi</string>
</array>
<key>CFBundleTypeName</key>
<string>AVI container</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mov</string>
<string>moov</string>
<string>qt</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>video/quicktime</string>
</array>
<key>CFBundleTypeName</key>
<string>Apple QuickTime container</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>divx</string>
</array>
<key>CFBundleTypeName</key>
<string>DivX file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>dv</string>
</array>
<key>CFBundleTypeName</key>
<string>DV file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>wmv</string>
<string>wm</string>
</array>
<key>CFBundleTypeName</key>
<string>Windows Media Video</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mpg</string>
<string>mpeg</string>
<string>mpeg1</string>
<string>mpeg2</string>
</array>
<key>CFBundleTypeName</key>
<string>multiplexed MPEG-1/2</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>m1v</string>
</array>
<key>CFBundleTypeName</key>
<string>MPEG-1 Video File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ts</string>
<string>m2ts</string>
<string>mts</string>
<string>mt2s</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>video/mp2t</string>
</array>
<key>CFBundleTypeName</key>
<string>MPEG-2 Transport Stream</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>m2v</string>
<string>mpv</string>
</array>
<key>CFBundleTypeName</key>
<string>MPEG-2 Video File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mp4</string>
<string>mpeg4</string>
<string>m4v</string>
</array>
<key>CFBundleTypeName</key>
<string>MPEG-4 File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>3gp</string>
</array>
<key>CFBundleTypeName</key>
<string>3GPP File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mkv</string>
</array>
<key>CFBundleTypeName</key>
<string>Matroska Video File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>webm</string>
</array>
<key>CFBundleTypeName</key>
<string>WebM Video File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>nuv</string>
</array>
<key>CFBundleTypeName</key>
<string>NuppleVideo File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
</array>
我已经能够在 NSView 的 draggingEntered
方法中验证放置接受情况,但我希望能够运行 CFBundleDocumentTypes 的
而不是复制此方法中的所有条目。如何执行此操作,以便我的 View 接受与 Info.plist
条目CFBundleDocumentTypes
条目中列出的完全相同的文件?
最佳答案
只需向您的包询问信息即可:
NSArray* documentTypes = [[[NSBundle mainBundle] infoDictionary]
objectForKey:@"CFBundleDocumentTypes"];
这将返回一个字典数组,每个字典对应一种文件类型,您可以从中轻松提取其他信息:
for(NSDictionary* docInfo in documentTypes)
{
NSArray* fileExtensions = [docInfo objectForKey:@"CFBundleTypeExtensions"];
//do something with this info
}
您可以将其与 NSDocumentController
的 -documentClassForType:
方法结合使用。这将 CFBundleTypeName
Info.plist
键中的值作为类型。
关于objective-c - 使用 CFBundleDocumentTypes 过滤拖放 NSView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8303744/
像 Drop Box 或 Airsharing 这样的程序不会处理或编辑文档,而是存储它们。在这种情况下,它们似乎必须注册为任何类型文件的有效选择。有没有办法将您的应用程序注册为所有文件的处理程序?
现在我正在为 iOS 制作一个基于文档的应用程序。我目前正在尝试注册 .zip 以使用我的应用程序打开。我试过 apple 的示例和许多其他教程,例如 here .但是,它们都没有使我的应用程序出现在
我正在尝试使用 CFBundleDocumentTypes 将自定义文件扩展名与我的应用程序关联。据我所知,这似乎“有效”——当我双击该文件时,JavaApplicationStub 会启动我的应用程
当我尝试向 App Store 验证我的应用程序时,出现以下错误,如下所示: 此 bundle 无效。 Info.plist 中 CFBundleDocumentTypes 键的值必须是字典数组,每个
我已经使用以下信息设置了我的 info.plist。当您从电子邮件访问文件时,我的应用程序会被列出,但我希望当有人在他们的照片应用程序中时,我的应用程序会被列出。我还需要做些什么才能列在“照片”应用中
我有一个拖放 NSView,它应该接受与我在 plist 的 CFBundleDocumentTypes 键下列出的相同的文件类型和扩展名>。该应用接受 public.movie 类型未选取的任何
您可以动态地将 CFBundleDocumentTypes 分配给您的 Cocoa 应用程序吗?这意味着在运行时我可以为我的应用程序分配更多扩展来处理。 目前,我为我的应用程序设置了一些扩展来处理 I
有人让 UIFileSharingEnabled 或 CFBundleDocumentTypes 工作吗?我将 UIFileSharingEnabled 添加为 true 到我的 plist 中,并使
我想添加在我的应用程序中打开某些特定类型音频的功能:.caf、.aiff、.wav 和 .mp3。根据 official guide,我已将“文档类型”项添加到 info.plist .这是一个屏幕截
我最近为我的 iPad 买了一个完美的文件管理器应用程序。这个应用程序中的一切都很棒,除了它无法处理某些特定的文件类型。 例如,如果我尝试在移动 safari 中下载文件并尝试将其保存到文件管理器中(
我正在尝试向现有应用添加额外的“打开方式”功能。我找到了一种将必要的 CFBundleDocumentTypes 添加到应用程序包中的 Info.plist 的方法。现在我唯一的问题是让 iOS 注册
我正在尝试为所有可能的文件类型注册我的应用程序。我将以下内容添加到我的 info.plist 中: CFBundleDocumentTypes CFBundleTypeNa
我正在尝试在 ionic 框架中构建一个应用程序。 我正在尝试构建此功能,就像当我单击图库中的照片并点击共享时,共享面板将打开。我想在这里展示我的应用程序。 我对plist文件做了一些修改 这是我的p
我开发了一个 Mac 应用程序,用于保存和加载独特类型的文件。该类型在 CFBundleDocumentTypes 下的 info.plist 中正确声明,列为 LSHandlerRank: Owne
我是一名优秀的程序员,十分优秀!