gpt4 book ai didi

swift - 如何为 UI 测试包启用网络流量? (XCTest、XCode - DNSServiceCreateConnection 失败)

转载 作者:搜寻专家 更新时间:2023-11-01 05:35:40 34 4
gpt4 key购买 nike

当我使用来自集成测试(单元测试包)的 http/https 通信时,它工作正常。但是,当我在 UI 测试包中使用相同的代码时,出现以下错误跟踪:

Request Content:
XCTRunner[6389:1020209] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
XCTRunner[6389:1020209] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
XCTRunner[6389:1020209] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
XCTRunner[6389:1020209] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:8 Err:-1 Errno:1 Operation not permitted
XCTRunner[6389:1020209] [] nw_resolver_create_dns_service_on_queue DNSServiceCreateConnection failed: ServiceNotRunning(-65563)
XCTRunner[6389:1020209] [] __nw_connection_get_connected_socket_block_invoke 2 Connection has no connected handler
XCTRunner[6389:1020207] PAC stream failed with
XCTRunner[6389:1020208] [] nw_proxy_resolver_create_parsed_array PAC evaluation error: kCFErrorDomainCFNetwork: -72000
XCTRunner[6389:1020208] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
XCTRunner[6389:1020208] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
XCTRunner[6389:1020208] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
XCTRunner[6389:1020208] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:7 Err:-1 Errno:1 Operation not permitted
XCTRunner[6389:1020208] [] nw_resolver_create_dns_service_on_queue DNSServiceCreateConnection failed: ServiceNotRunning(-65563)

最佳答案

我在 Apple 发起了技术支持事件,他们回答说这是他们方面的错误。请让我在他们的错误报告系统中打开一张票。门票自 2016 年 12 月 20 日起开放。希望他们能尽快解决。


与此同时,我找到了解决方法。我把:

#if DEBUG  
// cleaning server configuration
#endif

在生产代码中,我正在那里进行必要的清理操作。如果在 Debug模式下构建,此代码将在生产代码中翻译。

关于swift - 如何为 UI 测试包启用网络流量? (XCTest、XCode - DNSServiceCreateConnection 失败),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41185830/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com