Hello,
I have a company laptop thats connected to the internet without a VPN. I need to be able to resolve my company's sub domains using a specific dns server, and have all other domains resolved by the system wide name server.
In windows, this is trivial to do. In an admin powershell I run
"Add-DnsClientNrptRule -Namespace ".foo.mycompany.com" -Nameserver "127.0.0.1"
and resolution requests for *.foo.mycompany.com is sent to a name server running on the localhost. All other dns resolution requests are handled by the system configured resolver.
MacOS does have the /etc/resolver/ solution for this, but my understanding from these forums is that this is not the recommended approach. Note - I have tried it and it works.
AFAIU, the recommended approach is to create a system Network extension using NEDNSProxyProvider, override handleNewFlow() and do what's necessary.
The issue with this solution is that it requires
handling all the dns flow
parsing of DNS datagrams to extract the host
forwarding the datagrams to the appropriate dns server
Handle responses.
Deal with flow control
Handle edge cases.
I was hoping for something much simpler than us needing to implement datagram parsing.
Could you please shed light on our options and how we could proceed ?
Networking
RSS for tagExplore the networking protocols and technologies used by the device to connect to Wi-Fi networks, Bluetooth devices, and cellular data services.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Just bought a macbook pro m4, im trying to run an api on port 5000, disabled airplay receiver, checked processes, ghost ones, hidden ones, and stuck ones. I didn't find a thing using the port, but i still get port in use.
Topic:
App & System Services
SubTopic:
Networking
There is no Network Extension icon missing in System Settings.
Sequoia 15.1 (24B83)
Screenshot attached
Topic:
App & System Services
SubTopic:
Networking
For important background information, read Extra-ordinary Networking before reading this.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Broadcasts and Multicasts, Hints and Tips
I regularly see folks struggle with broadcasts and multicasts on Apple platforms. This post is my attempt to clear up some of the confusion.
This post covers both IPv4 and IPv6. There is, however, a key difference. In IPv4, broadcasts and multicasts are distinct concepts. In contrast, IPv6 doesn’t support broadcast as such; rather, it treats broadcasts as a special case of multicasts. IPv6 does have an all nodes multicast address, but it’s rarely used.
Before reading this post, I suggest you familiarise yourself with IP addresses in general. A good place to start is The Fount of All Knowledge™.
Service Discovery
A lot of broadcast and multicast questions come from folks implementing their own service discovery protocol. I generally recommend against doing that, for the reasons outlined in the Service Discovery section of Don’t Try to Get the Device’s IP Address.
There are, however, some good reasons to implement a custom service discovery protocol. For example, you might be working with an accessory that only supports this custom protocol [1]. If you must implement your own service discovery protocol, read this post and also read the advice in Don’t Try to Get the Device’s IP Address.
IMPORTANT Sometimes I see folks implementing their own version of mDNS. This is almost always a mistake:
If you’re using third-party tooling that includes its own mDNS implementation, it’s likely that this tooling allows you to disable that implementation and instead rely on the Bonjour support that’s built-in to all Apple platforms.
If you’re doing some weird low-level thing with mDNS or DNS-SD, it’s likely that you can do that with the low-level DNS-SD API.
[1] And whose firmware you can’t change! I talk more about this in Working with a Wi-Fi Accessory.
API Choice
Broadcasts and multicasts typically use UDP [1]. TN3151 Choosing the right networking API describes two recommended UDP APIs:
Network framework
BSD Sockets
Our general advice is to prefer Network framework over BSD Sockets, but UDP broadcasts and multicasts are an exception to that rule. Network framework has very limited UDP broadcast support. And while it’s support for UDP multicasts is less limited, it’s still not sufficient for all UDP applications. In cases where Network framework is not sufficient, BSD Sockets is your only option.
[1] It is possible to broadcast and multicast at the Ethernet level, but I almost never see questions about that.
UDP Broadcasts in Network Framework
Historically I’ve claimed that Network framework was useful for UDP broadcasts is very limited circumstances (for example, in the footnote on this post). I’ve since learnt that this isn’t the case. Or, more accurately, this support is so limited (r. 122924701) as to be useless in practice.
For the moment, if you want to work with UDP broadcasts, your only option is BSD Sockets.
UDP Multicasts in Network Framework
Network framework supports UDP multicast using the NWConnectionGroup class with the NWMulticastGroup group descriptor. This support has limits. The most significant limit is that it doesn’t support broadcasts; it’s for multicasts only.
Note This only relevant to IPv4. Remember that IPv6 doesn’t support broadcasts as a separate concept.
There are other limitations, but I don’t have a good feel for them. I’ll update this post as I encounter issues.
Local Network Privacy
Some Apple platforms support local network privacy. This impacts broadcasts and multicasts in two ways:
Broadcasts and multicasts require local network access, something that’s typically granted by the user.
Broadcasts and multicasts are limited by a managed entitlement (except on macOS).
TN3179 Understanding local network privacy has lots of additional info on this topic, including the list of platforms to which it applies.
Send, Receive, and Interfaces
When you broadcast or multicast, there’s a fundamental asymmetry between send and receive:
You can reasonable receive datagrams on all broadcast-capable interfaces.
But when you send a datagram, it has to target a specific interface.
The sending behaviour is the source of many weird problems. Consider the IPv4 case. If you send a directed broadcast, you can reasonably assume it’ll be routed to the correct interface based on the network prefix. But folks commonly send an all-hosts broadcast (255.255.255.255), and it’s not obvious what happens in that case.
Note If you’re unfamiliar with the terms directed broadcast and all-hosts broadcast, see IP address.
The exact rules for this are complex, vary by platform, and can change over time. For that reason, it’s best to write your broadcast code to be interface specific. That is:
Identify the interfaces on which you want to work.
Create a socket per interface.
Bind that socket to that interface.
Note Use the IP_BOUND_IF (IPv4) or IPV6_BOUND_IF (IPv6) socket options rather than binding to the interface address, because the interface address can change over time.
Extra-ordinary Networking has links to other posts which discuss these concepts and the specific APIs in more detail.
Miscellaneous Gotchas
A common cause of mysterious broadcast and multicast problems is folks who hard code BSD interface names, like en0. Doing that might work for the vast majority of users but then fail in some obscure scenarios.
BSD interface names are not considered API and you must not hard code them. Extra-ordinary Networking has links to posts that describe how to enumerate the interface list and identify interfaces of a specific type.
Don’t assume that there’ll be only one interface of a given type. This might seem obviously true, but it’s not. For example, our platforms support peer-to-peer Wi-Fi, so each device has multiple Wi-Fi interfaces.
When sending a broadcast, don’t forget to enable the SO_BROADCAST socket option.
If you’re building a sandboxed app on the Mac, working with UDP requires both the com.apple.security.network.client and com.apple.security.network.server entitlements.
Some folks reach for broadcasts or multicasts because they’re sending the same content to multiple devices and they believe that it’ll be faster than unicasts. That’s not true in many cases, especially on Wi-Fi. For more on this, see the Broadcasts section of Wi-Fi Fundamentals.
Snippets
To send a UDP broadcast:
func broadcast(message: Data, to interfaceName: String) throws {
let fd = try FileDescriptor.socket(AF_INET, SOCK_DGRAM, 0)
defer { try! fd.close() }
try fd.setSocketOption(SOL_SOCKET, SO_BROADCAST, 1 as CInt)
let interfaceIndex = if_nametoindex(interfaceName)
guard interfaceIndex > 0 else { throw … }
try fd.setSocketOption(IPPROTO_IP, IP_BOUND_IF, interfaceIndex)
try fd.send(data: message, to: ("255.255.255.255", 2222))
}
Note These snippet uses the helpers from Calling BSD Sockets from Swift.
To receive UDP broadcasts:
func receiveBroadcasts(from interfaceName: String) throws {
let fd = try FileDescriptor.socket(AF_INET, SOCK_DGRAM, 0)
defer { try! fd.close() }
let interfaceIndex = if_nametoindex(interfaceName)
guard interfaceIndex > 0 else { fatalError() }
try fd.setSocketOption(IPPROTO_IP, IP_BOUND_IF, interfaceIndex)
try fd.setSocketOption(SOL_SOCKET, SO_REUSEADDR, 1 as CInt)
try fd.setSocketOption(SOL_SOCKET, SO_REUSEPORT, 1 as CInt)
try fd.bind("0.0.0.0", 2222)
while true {
let (data, (sender, port)) = try fd.receiveFrom()
…
}
}
IMPORTANT This code runs synchronously, which is less than ideal. In a real app you’d run the receive asynchronously, for example, using a Dispatch read source. For an example of how to do that, see this post.
If you need similar snippets for multicast, lemme know. I’ve got them lurking on my hard disk somewhere (-:
Other Resources
Apple’s official documentation for BSD Sockets is in the man pages. See Reading UNIX Manual Pages. Of particular interest are:
setsockopt man page
ip man page
ip6 man page
If you’re not familiar with BSD Sockets, I strongly recommend that you consult third-party documentation for it. BSD Sockets is one of those APIs that looks simple but, in reality, is ridiculously complicated. That’s especially true if you’re trying to write code that works on BSD-based platforms, like all of Apple’s platforms, and non-BSD-based platforms, like Linux.
I specifically recommend UNIX Network Programming, by Stevens et al, but there are lots of good alternatives.
https://unpbook.com
Revision History
2025-09-01 Fixed a broken link.
2025-01-16 First posted.
I have granted local network permissions, but sometimes I get a second confirmation popup, what is the timing of the secondary popup?
Hi All, I am trying to write an NWProtocolFramerImplementation that will run after Websockets. I would like to achieve two goals with this
Handle the application-layer authentication handshake in-protocol so my external application code can ignore it
Automatically send pings periodically so my application can ignore keepalive
I am running into trouble because the NWProtocolWebsocket protocol parses websocket metadata into NWMessage's and I don't see how to handle this at the NWProtocolFramerImplementation level
Here's what I have (see comments for questions)
class CoolProtocol: NWProtocolFramerImplementation {
static let label = "Cool"
private var tempStatusCode: Int?
required init(framer: NWProtocolFramer.Instance) {}
static let definition = NWProtocolFramer.Definition(implementation: CoolProtocol.self)
func start(framer: NWProtocolFramer.Instance) -> NWProtocolFramer.StartResult { return .willMarkReady }
func wakeup(framer: NWProtocolFramer.Instance) { }
func stop(framer: NWProtocolFramer.Instance) -> Bool { return true }
func cleanup(framer: NWProtocolFramer.Instance) { }
func handleOutput(framer: NWProtocolFramer.Instance, message: NWProtocolFramer.Message, messageLength: Int, isComplete: Bool) {
// How to write a "Message" onto the next protocol handler. I don't want to just write plain data.
// How to tell the websocket protocol framer that it's a ping/pong/text/binary...
}
func handleInput(framer: NWProtocolFramer.Instance) -> Int {
// How to handle getting the input from websockets in a message format? I don't want to just get "Data" I would like to know if that data is
// a ping, pong, text, binary, ...
}
}
If I implementing this protocol at the application layer, here's how I would send websocket messages
class Client {
...
func send(string: String) async throws {
guard let data = string.data(using: .utf8) else {
return
}
let metadata = NWProtocolWebSocket.Metadata(opcode: .text)
let context = NWConnection.ContentContext(
identifier: "textContext",
metadata: [metadata]
)
self.connection.send(
content: data,
contentContext: context,
isComplete: true,
completion: .contentProcessed({ [weak self] error in
...
})
)
}
}
You see at the application layer I have access to this context object and can access NWProtocolMetadata on the input and output side, but in NWProtocolFramer.Instance I only see
final func writeOutput(data: Data)
which doesn't seem to include context anywhere.
Is this possible? If not how would you recommend I handle this? I know I could re-write the entire Websocket protocol framer, but it feels like I shouldn't have to if framers are supposed to be able to stack.
I want to check if the device has a internet connection or not by pinging DNS "8.8.8.8".
connection.send(content: content, completion: .contentProcessed {[weak self] error in
send function is not returning any error even if the host is unreachable.
I am checking if I can receive the data or not but connection.receiveMessage function never returns.
This is the complete code which I am following:
private let networkMonitor = NWPathMonitor()
private var connection: NWConnection
@MainActor var isConnectedToInternet = false
init(host: NWEndpoint.Host = "8.8.8.8",
port: NWEndpoint.Port = 53) {
let endpoint = NWEndpoint.hostPort(host: host, port: port)
connection = NWConnection(to: endpoint, using: .udp)
startMonitoring()
}
private func startMonitoring() {
networkMonitor.pathUpdateHandler = { [weak self] path in
guard let self else { return }
ping(callback: { isSuccess in
print("***** ping status:", isSuccess)
Task { @MainActor in
self.isConnectedToInternet = isSuccess
}
})
}
let queue = DispatchQueue(label: QueueLabel.networkMonitor)
networkMonitor.start(queue: queue)
}
func ping(
host: NWEndpoint.Host = "8.8.8.8",
port: NWEndpoint.Port = 53,
callback: @escaping ((Bool) -> Void)
) {
var didSendState = false
connection.stateUpdateHandler = {[weak self] state in
guard let self = self else { return }
guard !didSendState else {
if state != .cancelled {
cancel(connection)
}
return
}
switch state {
case .ready:
// State is ready now send data
let content = "Ping".data(using: .utf8)
let startTime = Date()
connection.send(content: content, completion: .contentProcessed {[weak self] error in
guard let self = self else { return }
if error != nil {
callback(false)
didSendState = true
cancel(connection)
} else {
print("Ping sent, waiting for response...")
connection.receiveMessage { [weak self] content, _, _, receiveError in
guard let self = self else { return }
if let receiveError {
print("Error receiving ping: \(receiveError.localizedDescription)")
callback(false)
} else if let content = content, String(data: content, encoding: .utf8) == "Ping" {
let roundTripTime = Date().timeIntervalSince(startTime)
print("Ping received! Round-trip time: \(roundTripTime) seconds")
callback(true)
} else {
print("Invalid response received")
callback(true)
}
didSendState = true
cancel(connection)
}
}
})
case .failed( _), .waiting( _), .cancelled:
didSendState = true
callback(false)
case .setup, .preparing:
// No callback because the ping has not yet succeeded or failed
break
@unknown default:
didSendState = true
callback(false)
// We don't know what this unknown default means, so cancel pings to be safe
cancel(connection)
}
}
connection.start(queue: .main)
}
func cancel(_ connection: NWConnection) {
connection.cancel()
}
}
Can anyone please help what I am doing wrong.
I'm writing a SwiftUI LDAP Browser. I built a command line swift app to do some testing and it works fine. I had to add the certificates from the LDAP server to the system keychain before it would work with TLS/SSL.
Then I ported the same code into a SwiftUI app but I cannot get it to connect via TLS/SSL. On the same machine with the same certs it errors with:
An unexpected error occurred: message("Can't contact LDAP server")
It connect fine with our TLS/SSL.
I suspect this may have to do with App Transport Security. Can anyone point me in the right direction to resolve this? App is MacOS only.
Topic:
App & System Services
SubTopic:
Networking
We have Mac OS VM which has two network interfaces and both are active. In our application we need “State:/Network/Global/IPv6” to do some task but on this machine it seems to be missing, however if we disable one of the interface then the same setting seems to be available and our code works fine.
Please find the attached screenshots of working & non-working details:
Topic:
App & System Services
SubTopic:
Networking
Tags:
Network Extension
Network
System Configuration
Hi Team,
We are getting below error when we try to connect our REST APIs from our device. Our application is enterprise application and its connecting all backend calls via MobileIron Secure Tunnel(VPN). We are not encountering this error when we try to connect backend system from Simulator on VPN connected machine. We are calling 13 APIs but we are getting below error intermittently for different APIs i.e each time we are facing this issue for different APIs. We connected with our Helpdesk team to troubleshoot the error and they checked the MobileIron VPN firewall and there is no log
We configured below things
Allow Arbitrary Loads - True
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
We are using Alamofire library to connect backend. We disabled all site validation and we configured minTLSVersion 1.2. Please find below code snippet
static let serverTrustPolicies:[String: ServerTrustEvaluating] = {
var sites = [String]()
sites.append("apis.xyz.com")
return sites.reduce([String: ServerTrustEvaluating]()) { (dictionary, site) -> [String: Alamofire.ServerTrustEvaluating] in
var dictionary = dictionary
dictionary[site] = DisabledTrustEvaluator()
return dictionary
}
}()
static let manager: Session = {
var serverTrustPolicies: [String: ServerTrustEvaluating] = NetworkClient.serverTrustPolicies
let configuration = URLSessionConfiguration.default
configuration.tlsMinimumSupportedProtocolVersion = .TLSv12
return Alamofire.Session(configuration: configuration,
serverTrustManager: CustomTrustManager(evaluators: serverTrustPolicies))
}()
error from Alamofire
Topic:
App & System Services
SubTopic:
Networking
on MacOS I am using raw socket and PF_Route options to monitor the routing table changes but looks like that is not supported in iOS
what are the other ways to achieve real time monitoring in iOS ?
Topic:
App & System Services
SubTopic:
Networking
Hi everyone,
is there any ways we can remove the weak ciphers as part of TLS handshake (TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256)
I checked here but still do not see anyways to print out and change the ciphers suite we want to use
https://forums.developer.apple.com/forums/thread/43230
https://forums.developer.apple.com/forums/thread/700406?answerId=706382022#706382022
Is this technical solution reasonable about WKWebView on cross-domain issues ?
Hi,all
My project use WKWebView to load offline package, such as .html/.css/.js,and also request some resources from remote server to update pages. So there is a cross-domain problem with local file(file://***) and remote domain (https://***), is this following technical solution reasonable to fix this problem:
1. Create a custom URLSchemeHandler which conforms to WKURLSchemeHandler
2.Unify local file and remote domain request to https request
3. Hook WKWebView https request
4. Implement WKURLSchemeHandler delegate method
(void)webView:(WKWebView *)webView startURLSchemeTask:(id)urlSchemeTask {
NSURL *url = urlSchemeTask.request.URL;
if ([url.pathExtension isEqualToString:@"html"]) {
NSData *data = [[NSData alloc] initWithContentsOfFile:localFilePath];
NSMutableDictionary resHeader = [NSMutableDictionary new];
[resHeader setValue:@"" forKey:@"Access-Control-Allow-Origin"];
[resHeader setValue:@"charset=UTF-8" forKey:@"Content-Type"];
[resHeader setValue:@"text/html" forKey:@"Content-Type"];
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc]
initWithURL:url statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:resHeader];
[urlSchemeTask didReceiveResponse:response];
[urlSchemeTask didReceiveData:data];
[urlSchemeTask didFinish];
} else {
NSURLSession *defaultSession = [NSURLSession sharedSession];
NSURLSessionTask *dataTask = [defaultSession dataTaskWithRequest:urlSchemeTask.request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
[urlSchemeTask didReceiveResponse:response];
[urlSchemeTask didReceiveData:data];
[urlSchemeTask didFinish];
}];
[dataTask resume];
}
}
Is this technical solution reasonable? and is there any issues that I haven't considered?
Sincerely,
Looking forward to your reply
In order to create a Message Filter Extension it is necessary to set up Shared Web Credentials.
I'd like to form an understanding of what role SWC plays when the OS is making request to the associated network service (when the extension has called deferQueryRequestToNetwork()) and how this differs from when an app directly uses Shared Web Credentials itself.
When an app is making direct use of SWC, it makes a request to obtain the user's credentials from the web site.
However in the case of a Message Filter Extension, there aren't any individual user credentials, so what is happening behind the scenes when the OS makes a server request on behalf of a Message Filtering Extension?
A more general question - the documentation for Shared Web Credentials says "Associated domains establish a secure association between domains and your app.".
Thank you
Topic:
App & System Services
SubTopic:
Networking
Tags:
iOS
SMS and Call Reporting
Authentication Services
We are developing an iOS app and are using Firebase's Auth module. During IPv6 network testing, we found that the app fails when calling Apple's login authorization in an IPv6 environment.
After investigation, we confirmed that the following two API calls:
https://gateway.icloud.com.cn:443/ckdatabase/api/client/record/save
https://gsa.apple.com/grandslam/GsService2
remain in a pending state.
We tested gateway.icloud.com.cn and gsa.apple.com and found that these two domains do not support IPv6 DNS.
What we would like to understand is whether these two domains truly do not support IPv6 DNS, and how we can implement Apple's login authorization in an IPv6 environment.
I am setting up a fake VPN with proxy settings using NEPacketTunnelProvider. When I check proxy check sites, I can see the proxy is detected.
let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "10.0.0.1")
let proxySettings = NEProxySettings()
proxySettings.httpEnabled = true
proxySettings.httpsEnabled = true
proxySettings.httpServer = NEProxyServer(address: hostIP, port: portNumber)
proxySettings.httpsServer = NEProxyServer(address: hostIP2, port: portNumber2)
proxySettings.excludeSimpleHostnames = false
proxySettings.matchDomains = [""]
settings.proxySettings = proxySettings
How can I control whether other installed apps on the phone use or bypass this proxy? Can I do this with exceptionList? Since I am routing everything through a VPN, I assumed I could control this. The selection of which apps use the proxy should be up to the user.
Could you provide an explanation of how I can manage this? I am quite new to these types of tasks.
The Wi‑Fi Alliance’s Wi‑Fi Aware data communication uses IPv6.
However, in Chapter 53 “Wi‑Fi Aware” of the Accessory Design Guidelines for Apple Devices, Release R26, it is stated that “The Neighbor Discovery Protocol (NDP) for IPv6 address resolution is not supported.”
This has caused confusion among developers: Does Apple’s Wi‑Fi Aware data communication actually use IPv6?
What is the impact of “The Neighbor Discovery Protocol (NDP) for IPv6 address resolution is not supported” in Apple’s implementation?
Hi, all. We have a camera with only one WiFi module. It supports AP and STA modes coexisting, but the WiFi of AP and STA can only be in the same channel at the same time, that is, 2.4G or 5G. In the initial state, the App is connected to the camera through 5G WiFi, and the camera is in AP mode. When entering the network configuration mode, the camera will start the STA mode, and the AP and STA modes coexist. When the user selects 2.4G WiFi, the AP mode will switch from 5G to 2.4G. Android's WiFi and socket are not disconnected, iOS's socket will be disconnected 100%, and WiFi may be disconnected.
What is the reason for this? Is there any way to solve it?
我的完整报错信息:
Task <0568A3A0-A40C-42A8-9491-2FC52D71EFFF>.<4> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "似乎已断开与互联网的连接。" UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x107db5590 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=50, _NSURLErrorNWResolutionReportKey=Resolved 0 endpoints in 1ms using unknown from cache, _NSURLErrorNWPathKey=unsatisfied (Denied over Wi-Fi interface), interface: en0[802.11], ipv4, dns, uses wifi}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0568A3A0-A40C-42A8-9491-2FC52D71EFFF>.<4>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <0568A3A0-A40C-42A8-9491-2FC52D71EFFF>.<4>"
), NSLocalizedDescription=似乎已断开与互联网的连接。, NSErrorFailingURLStringKey=https://sharkserver.dypc.top/shark_user/login, NSErrorFailingURLKey=https://sharkserver.dypc.top/shark_user/login, _kCFStreamErrorDomainKey=1}
请求失败:似乎已断开与互联网的连接。
以下是问题的具体描述
我的A手机(15pro max 版本18,6,1) 使用xcode直接在A手机上运行我的程序 尝试发起post请求的时候得到了该报错。
我做了以下尝试
1.检查了A手机网络,一切正常,浏览器和其他app均可正常访问网络
2.检查了A手机上我的app权限,确认我因为为我的程序打开了无线网络和蜂窝流量
3.重启A手机,还原A手机网络设置,还原A手机所有设置,重启mac电脑
以上做法均无效,依旧报上面的错误
4.然后我尝试使用B手机(iPhone13 版本18.5)安装该程序 ,B手机可以正常运行并成功发起post请求,证明我的代码没有问题
5.我将代码上传至testfight 然后使用A手机下载testfight里的该程序 ,程序可以成功发起post请求没有任何错误,我再次使用xcode运行该程序到真机,又得到了Code=-1009错误 无法发起post请求
General:
Forums subtopic: App & System Services > Networking
TN3151 Choosing the right networking API
Networking Overview document — Despite the fact that this is in the archive, this is still really useful.
TLS for App Developers forums post
Choosing a Network Debugging Tool documentation
WWDC 2019 Session 712 Advances in Networking, Part 1 — This explains the concept of constrained networking, which is Apple’s preferred solution to questions like How do I check whether I’m on Wi-Fi?
TN3135 Low-level networking on watchOS
TN3179 Understanding local network privacy
Adapt to changing network conditions tech talk
Understanding Also-Ran Connections forums post
Extra-ordinary Networking forums post
Foundation networking:
Forums tags: Foundation, CFNetwork
URL Loading System documentation — NSURLSession, or URLSession in Swift, is the recommended API for HTTP[S] on Apple platforms.
Network framework:
Forums tag: Network
Network framework documentation — Network framework is the recommended API for TCP, UDP, and QUIC on Apple platforms.
Building a custom peer-to-peer protocol sample code (aka TicTacToe)
Implementing netcat with Network Framework sample code (aka nwcat)
Configuring a Wi-Fi accessory to join a network sample code
Moving from Multipeer Connectivity to Network Framework forums post
Network Extension (including Wi-Fi on iOS):
See Network Extension Resources
Wi-Fi Fundamentals
TN3111 iOS Wi-Fi API overview
Wi-Fi Aware framework documentation
Wi-Fi on macOS:
Forums tag: Core WLAN
Core WLAN framework documentation
Wi-Fi Fundamentals
Secure networking:
Forums tags: Security
Apple Platform Security support document
Preventing Insecure Network Connections documentation — This is all about App Transport Security (ATS).
Available trusted root certificates for Apple operating systems support article
Requirements for trusted certificates in iOS 13 and macOS 10.15 support article
About upcoming limits on trusted certificates support article
Apple’s Certificate Transparency policy support article
What’s new for enterprise in iOS 18 support article — This discusses new key usage requirements.
Technote 2232 HTTPS Server Trust Evaluation
Technote 2326 Creating Certificates for TLS Testing
QA1948 HTTPS and Test Servers
Miscellaneous:
More network-related forums tags: 5G, QUIC, Bonjour
On FTP forums post
Using the Multicast Networking Additional Capability forums post
Investigating Network Latency Problems forums post
WirelessInsights framework documentation
iOS Network Signal Strength
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"