使用 Xcode 9 构建时,文件提供程序扩展无法在 iOS 9 和 10 上启动

File Provider Extension fails to start on iOS 9 & 10 when built with Xcode 9

我有 iOS11 之前的 Action + Document + File Provider 扩展。我看到的问题如下:

当我的应用程序使用 Xcode 8 构建时,File Provider 在所有 iOSes 上工作正常。

当我的应用程序是使用 Xcode 9 构建时(无代码更改),File Provider 在 iOS 11 上运行良好,但未能在 iOS 9 和 10.

开始

文档选择器和操作扩展在任何地方都可以正常工作。

我需要在 Xcode 9 上构建,因为我想使用 Xcode 8 中不可用的 类。

以下是主应用程序启动时成功(Xcode 8)和不成功(Xcode 9)尝试注册文件提供程序扩展的设备日志。当另一个应用程序尝试调用该扩展程序时,会出现类似的消息。

Xcode 9 在 iOS 10

installd(MobileSystemServices)[42] <Notice>: 0x16e107000 -[MIContainer makeContainerLiveReplacingContainer:reason:withError:]: Made container live for com.companyname.appname.fileprovider at /private/var/mobile/Containers/Data/PluginKitPlugin/5B502EFD-DFA7-4F23-BCCE-EBF63F455B98
lsd(MobileCoreServices)[75] <Notice>: Found extensionPointData dict <com.apple.fileprovider-ui> for <private>
lsd(MobileCoreServices)[75] <Notice>: Found extensionPointData dict <com.apple.fileprovider-nonui> for <private>
SpringBoard(UserNotificationsServer)[49] <Notice>: [com.companyname.appname] Application installed using default data provider
SpringBoard(UserNotificationsServer)[49] <Notice>: Create new default data providers
fileproviderd(MobileCoreServices)[21] <Notice>: LaunchServices observer: Installed plugins <private>
fileproviderd(Foundation)[21] <Notice>: discovered extensions
assertiond[59] <Notice>: Ignoring assertion request named "com.apple.extension.session" from <BSProcessHandle: 0x10022bb30; fileproviderd:21; valid: YES> because process { pid 224; bundleID (null) } is unknown.
fileproviderd(Foundation)[21] <Notice>: calling plugIn beginUsing:
fileproviderd(PlugInKit)[21] <Notice>: connection to plug-in <private>(C96A6048-676A-4B17-8DEF-983B0BEA5656) lost
fileproviderd(PlugInKit)[21] <Error>: Hub connection error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.companyname.appname.fileprovider" UserInfo={NSDebugDescription=connection to service named com.companyname.appname.fileprovider}
fileproviderd(Foundation)[21] <Notice>: PlugInKit error in beginUsing:
fileproviderd[21] <Fault>: [ERROR] Extension request failed. Error: <private>
fileproviderd[21] <Fault>: [ERROR] Error registering file provider extension <private>: <private>.
fileproviderd[21] <Notice>: [NOTICE] Trying to register file provider extension <private> again. Tries left: 2
fileproviderd(Foundation)[21] <Notice>: killing invalid plugIn
fileproviderd(Foundation)[21] <Notice>: completed calling plugIn beginUsing: for pid: 0
assertiond[59] <Notice>: Ignoring assertion request named "com.apple.extension.session" from <BSProcessHandle: 0x10022bb30; fileproviderd:21; valid: YES> because process { pid 224; bundleID (null) } is unknown.
fileproviderd(Foundation)[21] <Notice>: calling plugIn beginUsing:
fileproviderd(PlugInKit)[21] <Error>: plug-in <private> pre-screen sees activating state
fileproviderd(PlugInKit)[21] <Notice>: connection to plug-in <private>(C96A6048-676A-4B17-8DEF-983B0BEA5656) lost
fileproviderd(PlugInKit)[21] <Error>: Hub connection error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.companyname.appname.fileprovider" UserInfo={NSDebugDescription=connection to service named com.companyname.appname.fileprovider}
fileproviderd(Foundation)[21] <Notice>: PlugInKit error in beginUsing:
fileproviderd[21] <Fault>: [ERROR] Extension request failed. Error: <private>
fileproviderd(Foundation)[21] <Notice>: killing invalid plugIn
fileproviderd[21] <Fault>: [ERROR] Error registering file provider extension <private>: <private>.

Xcode 8 iOS 10

fileproviderd(Foundation)[21] <Notice>: discovered extensions
installd(MobileSystemServices)[42] <Notice>: 0x16e107000 -[MIInstallableBundle _refreshUUIDForContainer:withError:]: Data container for com.companyname.appname.fileprovider is now at /private/var/mobile/Containers/Data/PluginKitPlugin/8B44BA26-5F62-465E-B40D-A0FE9F4277B1
lsd(MobileCoreServices)[75] <Notice>: Found extensionPointData dict <com.apple.fileprovider-ui> for <private>
lsd(MobileCoreServices)[75] <Notice>: Found extensionPointData dict <com.apple.fileprovider-nonui> for <private>
SpringBoard(UserNotificationsServer)[49] <Notice>: [com.companyname.appname] Application installed using default data provider
SpringBoard(UserNotificationsServer)[49] <Notice>: Create new default data providers
fileproviderd(Foundation)[21] <Notice>: discovered extensions
fileproviderd(MobileCoreServices)[21] <Notice>: LaunchServices: Waiting on mutex for local DB to be updated
fileproviderd(MobileCoreServices)[21] <Notice>: LaunchServices observer: Uninstalled plugins <private>
fileproviderd(MobileCoreServices)[21] <Notice>: LaunchServices observer: Installed plugins <private>
assertiond[59] <Notice>: Ignoring assertion request named "com.apple.extension.session" from <BSProcessHandle: 0x10022bb30; fileproviderd:21; valid: YES> because process { pid 224; bundleID (null) } is unknown.
fileproviderd(Foundation)[21] <Notice>: calling plugIn beginUsing:
FileProvider(ADAL)[319] <Notice>: ADAL version 2.3.1
kernel(Sandbox)[0] <Notice>: SandboxViolation: FileProvider(319) deny(1) file-read-data /private/var/mobile/Containers/Data/Application
kernel(Sandbox)[0] <Notice>: SandboxViolation: FileProvider(319) deny(1) file-read-data /private/var/mobile/Containers/Shared/AppGroup
fileproviderd(Foundation)[21] <Notice>: completed calling plugIn beginUsing: for pid: 319
FileProvider[319] <Notice>: ACFileProvider - "init" [319]:0x13dd560b0. Constructor

知道是什么原因造成的吗?我该如何解决? 谢谢

使用 Xcode 9 构建的文件提供程序不适用于 iOS 9 和 10。这是 iOS 11.1 Beta 发行说明中提到的 Apple 错误。希望他们会在某个时候根据他们的文档修复它,它应该可以工作。

更新: 已在 Xcode 9.1.

中修复