nw_read_request_report Receive failed with error "Software caused connection abort"

huangapple go评论80阅读模式
英文:

nw_read_request_report Receive failed with error "Software caused connection abort"

问题

我不知道是否有其他人收到这些消息,但当应用程序进入后台然后回到前台时,我会在日志中收到以下消息:

[] nw_read_request_report [C3] Receive failed with error "Software caused connection abort"

接着是:

无法发送信号给 com.apple.WebKit.WebContent 服务:113:找不到指定的服务

这些消息出现在许多其他糟糕的日志之后,例如:

我的项目中使用了 Firebase,这可能是所有与网络相关的日志的来源。

可能是什么原因导致这些问题?这是一个 bug 吗?


更新

我从第一条项目中的错误中移除了错误,详见我的答案此处

英文:

I don't know if anyone else is getting these messages, but I get these messages in the logs when the app goes into the background, then comes back:

> [] nw_read_request_report [C3] Receive failed with error "Software caused connection abort"

Followed by:

> Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

This is coming after many other bad logs, like:

My project has Firebase, which could be a source of all the web-related logs.

What could be causing it? Is it a bug?


Update

I removed errors from bullet no.1, written in my answer here.

答案1

得分: 3

我有同样的问题,关于Facebook SDK登录。解决方法是在SceneDelegate.swift文件中添加以下代码:

import FBSDKCoreKit

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
  if let openURLContext = URLContexts.first {
    ApplicationDelegate.shared.application(UIApplication.shared, open: 
    openURLContext.url, sourceApplication: 
    openURLContext.options.sourceApplication, annotation: 
    openURLContext.options.annotation)
  }    
}
英文:

I have the same issue with Facebook SDK login. Resolve it adding the following code in SceneDelegate.swift

import FBSDKCoreKit

func scene(_ scene: UIScene, openURLContexts URLContexts: Set&lt;UIOpenURLContext&gt;) {
  if let openURLContext = URLContexts.first {
    ApplicationDelegate.shared.application(UIApplication.shared, open: 
    openURLContext.url, sourceApplication: 
    openURLContext.options.sourceApplication, annotation: 
    openURLContext.options.annotation)
  }    
}

答案2

得分: 2

以下是已翻译的内容:

这与情况有些相关,希望对某人有所帮助。我的情况是,在从Facebook认证返回后,SceneDelegate 中提供的 openURL 额外函数未被调用。

解决方法是使用:

.onOpenURL { (url) in
    ApplicationDelegate.shared.application(
        UIApplication.shared,
        open: url,
        sourceApplication: nil,
        annotation: [UIApplication.OpenURLOptionsKey.annotation]
    )
}

在 Scene 实例的视图上,像这样:

var body: some Scene {
    WindowGroup {
        LoadingView()
            .onOpenURL { (url) in
                ApplicationDelegate.shared.application(
                    UIApplication.shared,
                    open: url,
                    sourceApplication: nil,
                    annotation: [UIApplication.OpenURLOptionsKey.annotation]
                )
            }
    }
}

然后,这将调用我的额外应用程序委托中的函数,然后正确关闭登录屏幕。

英文:

This is somewhat related, and hope it helps someone. My situation was that the openURL extra function provided in the SceneDelegate was not being called after returning from Facebook Authentication.

The solution was using

.onOpenURL { (url) in
    ApplicationDelegate.shared.application(
        UIApplication.shared,
        open: url,
        sourceApplication: nil,
        annotation: [UIApplication.OpenURLOptionsKey.annotation]
    )
}

On a view in the Scene instance, like so:

var body: some Scene {
    WindowGroup {
        LoadingView()
            .onOpenURL { (url) in
                ApplicationDelegate.shared.application(
                    UIApplication.shared,
                    open: url,
                    sourceApplication: nil,
                    annotation: [UIApplication.OpenURLOptionsKey.annotation]
                )
            }
    }
}

This then calls the function in my extra application delegate, which then dismissed the login screen properly.

答案3

得分: 2

我出现了这些错误。它们是因为我没有在一个NSURLSession上调用invalidateAndCancel方法引起的。

英文:

I had these errors. They were caused by my failure to call invalidateAndCancel on a NSURLSession.

答案4

得分: 0

使用Alamofire时,我遇到了相同的问题,它会导致确认电子邮件的请求出现问题。

如果你遇到相同的问题,请等待近2秒,然后通过Alamofire进行网络响应:

DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
    你的网络响应
}
英文:

I Had the same problem using Alamofire, it causes problem with request to confirm email

If you have the same issue - wait nearly 2 seconds to do you network response via Alamofire

 DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
       Your network response
}

huangapple
  • 本文由 发表于 2020年1月7日 02:22:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/59617057.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定