文件提供商扩展上传 - iOS11

File provider extension upload - iOS11

我正在尝试实现 FileProvider 方法 - (void)importDocumentAtURL:(NSURL *)fileURL toParentItemIdentifier:(NSFileProviderItemIdentifier)parentItemIdentifier completionHandler:(void (^)(NSFileProviderItem importedDocumentItem, NSError *error))completionHandler

尝试上传包含多个项目的文件夹时出现以下错误。之后我的 FileProviderItem 列表也被删除了。

2018-02-14 17:47:53.598426+0530 文件[8694:412673] [默认] [错误] fetchRemoteFileProviderVendorWithIdentifier:remoteObjectInterface:messageInterface:handler:connectionErrorHandler: (协议:FPXOperationService) 2018-02-14 17:47:53.598634+0530 文件[8694:412673] [默认] [错误] 执行操作时失去连接:错误域=NSCocoaErrorDomain 代码=4099 "Couldn’t communicate with a helper application." 2018-02-14 17:47:53.600929+0530 文件[8694:412677] [UI] performOperation(:sourceOperationItems:destinationItem:viewControllerForPresentingErrors:forceBounce:lastUsageUpdatePolicy:completion:): 复制操作失败:错误域=NSCocoaErrorDomain 代码=4099 "Couldn’t communicate with a helper application." UserInfo={NSUserStringVariant=Copy, NSFileProviderErrorItemName=arvind, NSFilePath=arvind} 2018-02-14 17:47:53.601841+0530 文件[8694:412106] [默认] [错误] 执行操作时失去连接:错误域=NSCocoaErrorDomain 代码=4099 "Couldn’t communicate with a helper application."

2018-02-14 17:47:53.608742+0530 文件[8694:412362] [默认] [错误] 无法获取标识符 xxxx 的文件提供程序端点; Error Domain=NSFileProviderInternalErrorDomain Code=7 "A connection to the extension “xxxx” could not be made." UserInfo={NSLocalizedDescription=A connection to the extension “xxxx” could not be made., NSUnderlyingError=0x1cc24f7b0 {Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named xxxx" UserInfo={ NSDebugDescription=连接到名为 xxxx 的服务}}} 2018-02-14 17:47:53.653542+0530 Files[8694:411277] [default] [ERROR] 在枚举更改时收到错误:Error Domain=NSFileProviderInternalErrorDomain Code=7 "A connection to the extension “xxxx” could not be made." UserInfo={NSLocalizedDescription=无法连接到扩展名“xxxx”。NSUnderlyingError=0x1cc24f7b0 {Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named xxxx" UserInfo={NSDebugDescription=connection to service named xxxx}}}

寻求帮助。有任何输入吗?

原来是内存问题。当我的文件提供程序的内存达到 ~15MB 时,应用程序崩溃。这是由于文件上传块大小引起的。我减少了块大小并且工作正常。我的猜测是,当 ARC 释放上传的块时,在我的用例中内存累积到 15MB。