简体   繁体   English

无法通过 iOS 共享扩展共享文件

[英]Inability Sharing a file via iOS Share Extension

I've received the following log from a customer who claims to be sharing photos from the photos app via Share Extension.我从一位声称通过 Share Extension 分享照片应用程序中的照片的客户那里收到了以下日志。 The customer is making an assumption that internet connection to the router is bad.客户假设路由器的互联网连接不良。 The behavior as described by the customer is as follows:客户描述的行为如下:

  1. Upload a file via share extension via a bad connection通过连接错误通过共享扩展上传文件
  2. Let device sleep, in our case the connection should get terminated and the file is not uploaded to our servers.让设备休眠,在我们的例子中,连接应该终止并且文件不会上传到我们的服务器。
  3. Attempt to re-upload the same file.尝试重新上传相同的文件。

Expected Result: The file should upload fine.预期结果:文件应该可以正常上传。

Actual Result: Share Extension never loads, that means that user can infinitely click the app icon with no success of showing the view.实际结果:共享扩展永远不会加载,这意味着用户可以无限单击应用程序图标而无法成功显示视图。

Adding to this, we have never been able to reproduce such a problem in house.除此之外,我们从未能够在内部重现这样的问题。 However, the customer can do so every time while in the airport.但是,客户每次在机场时都可以这样做。

I took a peek in his device logs, and I can see the following with no clue what is going in. Starting from the out of bound exception which I can't explain due to the fact that the view never loaded.我查看了他的设备日志,我可以看到以下内容,但不知道发生了什么。从越界异常开始,由于视图从未加载,因此我无法解释。

Any idea or did anyone else encounter the same problem?任何想法或有没有其他人遇到过同样的问题?

Apr 13 15:11:07 audi pkd[153] : assigning plug-in (2.1.2) to plugin sandbox 4 月 13 日 15:11:07 audi pkd[153]:将插件 (2.1.2) 分配给插件沙箱

Apr 13 15:11:07 audi pkd[153] : enabling pid=386 for plug-in (2.1.2) D89CEF37-B025-4C6F-A8B6-FBB6B4D94A84/private/var/containers/Bundle/Application/AF69E215-04AE-4929-A8C8-51BE8FADF397/.app/PlugIns/.appex 4 月 13 日 15:11:07 audi pkd[153]:为插件 (2.1.2) 启用 pid=386 D89CEF37-B025-4C6F-A8B6-FBB6B4D94A84/private/var/containers/Bundle/Application/AF604E2 4929-A8C8-51BE8FADF397/.app/PlugIns/.appex

Apr 13 15:11:07 audi kernel[0] : xpcproxy[451] Container: /private/var/mobile/Containers/Data/PluginKitPlugin/669C0F52-1C21-441D-9906-E2EFBD8A7D00(sandbox) 4 月 13 日 15:11:07 奥迪内核 [0]:xpcproxy[451] 容器:/private/var/mobile/Containers/Data/PluginKitPlugin/669C0F52-1C21-441D-9906-E2EFBD8A7D00(沙盒)

Apr 13 15:11:08 audi kernel[0] : LwVM::_generateMappedExtentsList - failed to map unmap range to partition 4 月 13 日 15:11:08 奥迪内核 [0]:LwVM::_generateMappedExtentsList - 无法将取消映射范围映射到分区

Apr 13 15:11:08 audi backboardd[60] : Unable to bootstrap_look_up port with name .gsEvents: unknown error code (1102) Apr 13 15:11:08 audi[451] : * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]' First throw call stack: (0x18400ae38 0x18366ff80 0x183eeb158 0x1000e4a40 0x1000e4738 0x183a554bc 0x183a5547c 0x183a5ab84 0x183fc0dd8 0x183fbec40 0x183ee8d10 0x1857d0088 0x1891bdf70 0x183cacd74 0x183caea2c 0x184acbd30 0x18b2e2c48 0x18b2e28dc 0x18b2e2c6c 0x1848de058 0x183a868b8) 4 月 13 日 15:11:08 audi backboardd[60]:无法使用名称为 .gsEvents 的 bootstrap_look_up 端口:未知错误代码(1102)4 月 13 日 15:11:08 audi[451]: * 由于未捕获的异常“NSRangeException”而终止应用程序,原因: '* - [__ NSArrayI objectAtIndex:]:索引1超出范围[0 .. 0]'第一掷调用堆栈:(0x18400ae38 0x18366ff80 0x183eeb158 0x1000e4a40 0x1000e4738 0x183a554bc 0x183a5547c 0x183a5ab84 0x183fc0dd8 0x183fbec40 0x183ee8d10 0x1857d0088 0x1891bdf70 0x183cacd74 0x183caea2c 0x184acbd30 0x18b2e2c48 0x18b2e28dc 0x18b2e2c6c 0x1848de058 0x183a868b8 )

Apr 13 15:11:08 audi MobileSlideShow[386] : plugin interrupted 4 月 13 日 15:11:08 audi MobileSlideShow[386]:插件中断

Apr 13 15:11:08 audi MobileSlideShow[386] : plugin invalidated 4 月 13 日 15:11:08 audi MobileSlideShow[386]:插件失效

Apr 13 15:11:08 audi diagnosticd[84] : error evaluating process info - pid: 451, puniqueid: 451 4 月 13 日 15:11:08 奥迪诊断 [84]:错误评估进程信息 - pid:451,puniqueid:451

Apr 13 15:11:08 audi mediaserverd[28] : '' (pid = 451) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None 4 月 13 日 15:11:08 audi mediaserverd[28]:''(pid = 451)设置 DiscoveryMode = DiscoveryMode_None,currentDiscoveryMode = DiscoveryMode_None

Apr 13 15:11:08 audi MobileSlideShow[386] : 2016-04-13 15:11:08.629|MobileSlideShow|0x14ce07cd0: HOST: Failed to load remote view controller with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named .viewservice was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid." Apr 13 15:11:08 audi MobileSlideShow[386] : 2016-04-13 15:11:08.629|MobileSlideShow|0x14ce07cd0: HOST: Failed to load remote view controller with error: Error Domain=NSCocoaErrorDomain Code=4099名为 .viewservice 的服务被中断,但消息是通过其他代理发送的,因此该代理已失效。” UserInfo= {NSDebugDescription=The connection to service named .viewservice was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.} UserInfo= {NSDebugDescription=与名为 .viewservice 的服务的连接被中断,但消息是通过其他代理发送的,因此该代理已失效。}

Apr 13 15:11:08 audi MobileSlideShow[386] : 2016-04-13 15:11:08.633|MobileSlideShow|0x14ce07cd0: Sheet not being presented, calling premature completion 4 月 13 日 15:11:08 audi MobileSlideShow[386] : 2016-04-13 15:11:08.633|MobileSlideShow|0x14ce07cd0:工作表未呈现,称过早完成

Apr 13 15:11:08 audi com.apple.xpc.launchd[1] ([451]) : Service exited due to signal: Abort trap: 6 4 月 13 日 15:11:08 audi com.apple.xpc.launchd[1] ([451]):服务因信号退出:中止陷阱:6

Apr 13 15:11:08 audi ReportCrash[452] : Formulating report for corpse[451] 4 月 13 日 15:11:08 audi ReportCrash[452]:为尸体制定报告[451]

Apr 13 15:11:08 audi ReportCrash[452] : Report of type '109(109_)' not saved because the limit of 25 logs has been reached 4 月 13 日 15:11:08 audi ReportCrash[452]:类型“109(109_)”的报告未保存,因为已达到 25 个日志的限制

Apr 13 15:11:08 audi ReportCrash[452] : Notice: This report is abbreviated for syslog inclusion because it could not be saved to disk. 4 月 13 日 15:11:08 audi ReportCrash[452]:注意:此报告被缩写为 syslog 包含,因为它无法保存到磁盘。

Symbolication may be possible by manually cleaning up and including the Binary Image section of a full report from this same device – good luck!可以通过手动清理并包含来自同一设备的完整报告的二进制图像部分来进行符号化 - 祝你好运!

Apr 13 15:11:08 audi ReportCrash[452] : Process: [451] Path: /private/var/containers/Bundle/Application/AF69E215-04AE-4929-A8C8-51BE8FADF397/.app/PlugIns/.appex/ 4 月 13 日 15:11:08 audi ReportCrash[452]:进程:[451] 路径:/private/var/containers/Bundle/Application/AF69E215-04AE-4929-A8C8-51BE8FADF397/.app/PlugIns/.appex/

in many cases the file is large, and connection is being freed before finishing, or something in same vane is happing, if it is something in this vane, a possible way around, write your file to app document folder first, then upload via a URL link from your document folder in app like this: (example with an image)在许多情况下,文件很大,并且连接在完成之前被释放,或者同一个叶片中的某些东西正在发生,如果它在这个叶片中,一种可能的方法,首先将您的文件写入应用程序文档文件夹,然后通过来自应用程序中文档文件夹的 URL 链接,如下所示:(带有图像的示例)

let documentsDirectoryPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let path = documentsDirectoryPath.appending("/outImage.jpg")
let outURL = URL(fileURLWithPath: path)

try? FileManager.default.removeItem(at: outURL)

        if let data2c = self.newImage.jpegData(compressionQuality:1.0)
        {
            do
            {
                try data2c.write(to: outURL)

                DispatchQueue.main.async
                {
                    var filesToShare = [Any]()
                    filesToShare.append(outURL)

                    let activityVC = UIActivityViewController(activityItems: filesToShare, applicationActivities: nil)
                    activityVC.excludedActivityTypes = [.print,.assignToContact,.copyToPasteboard,.addToReadingList,.markupAsPDF,.postToTencentWeibo,.postToTencentWeibo]
                    activityVC.popoverPresentationController?.sourceView = self.view
                    activityVC.preferredContentSize = CGSize(width: self.view.frame.size.width, height: self.view.frame.size.height-60)
                    activityVC.modalPresentationCapturesStatusBarAppearance = true

                    self.present(activityVC, animated: true, completion: nil)
                }

            } catch {
  print("Couldn't write file")
            }
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM