You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

macOS文件提供者扩展添加失败:无法找到对应标识符的扩展

macOS文件提供者扩展添加域失败排查方案

问题背景

用Xcode 16 + macOS Sequoia开发macOS文件提供者扩展,宿主应用点击「Add domain」按钮执行代码:

let domain = NSFileProviderDomain(identifier: NSFileProviderDomainIdentifier(rawValue: "me.piranef.fileprovider"), displayName: "piranef")
NSFileProviderManager.add(domain) { theError in
                NSLog(">>> ERROR: \(theError?.localizedDescription ?? "No error")")
}

添加文件提供者目标后,Finder未显示「piranef」提供者,报错:
No file provider was found with the identifier “me.piranef.MyFileProviderTester”

已做操作:修改扩展Bundle ID、同步宿主与扩展的App Groups、按Apple示例嵌入扩展并禁用签名。


排查步骤

1. 核对扩展Info.plist核心配置

  • 找到扩展的Info.plist,展开NSExtension > NSExtensionAttributes:
    • 确保NSFileProviderExtensionFileProviderIdentifier值完全等于报错里的me.piranef.MyFileProviderTester,且和扩展的Bundle ID一致;
    • 确认NSExtensionPointIdentifier设为com.apple.fileprovider-nonui(macOS文件提供者扩展的标准扩展点ID);
    • 新增NSFileProviderExtensionSupportedDomains数组,把代码里的域标识符me.piranef.fileprovider加进去,明确该扩展负责处理这个域。

2. 检查权限配置(entitlements文件)

  • 宿主应用的entitlements:必须包含com.apple.developer.fileprovider.domains权限,对应值设为你创建的域标识符me.piranef.fileprovider;
  • 扩展的entitlements:
    • 要有com.apple.developer.fileprovider权限,值设为true;
    • App Groups值和宿主完全一致;
    • 加入com.apple.developer.fileprovider.domain权限,值为me.piranef.fileprovider。

3. 修正嵌入与签名设置

  • 打开宿主应用的General页面,确认文件提供者扩展在Embedded Binaries列表里;
  • 签名配置不要手动关闭,用Xcode自动签名(macOS 14+对文件提供者签名要求严格,禁用签名会导致扩展无法被系统识别);
  • 确保宿主和扩展的签名团队、证书配置一致。

4. 重置系统缓存与服务

  • 清理Xcode Derived Data:打开Xcode设置→Locations→Derived Data,点击删除;
  • 重启Finder:终端执行killall Finder,或者Option+右键点击Dock里的Finder图标选「Relaunch」;
  • 手动注册扩展:终端执行pluginkit -m -p com.apple.fileprovider-nonui,查看已注册的扩展列表,如果你的扩展不在里面,找到扩展的.appex路径(一般在Derived Data的Debug产物里,宿主App的Contents/Plugins目录下),执行pluginkit -a [扩展路径]手动注册。

内容的提问来源于stack exchange,提问作者Francesco Piraneo G.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 14:07:14