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.
Moving to Fewer, Larger Transfers forums post
Testing Background Session Code forums post
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
NWEndpoint History and Advice 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).
WWDC 2017 Session 701 Your Apps and Evolving Network Security Standards [1] — This is generally interesting, but the section starting at 17:40 is, AFAIK, the best information from Apple about how certificate revocation works on modern systems.
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 forums post
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] This video is no longer available from Apple, but the URL should help you locate other sources of this info.
Foundation
RSS for tagAccess essential data types, collections, and operating-system services to define the base layer of functionality for your app using Foundation.
Posts under Foundation tag
189 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm trying to understand the behavior I'm seeing here. In the following example, I have a custom @Observable class that adopts RandomAccessCollection and am attempting to populate a List with it.
If I use an inner collection property of the instance (even computed as this shows), the top view identifies additions to the list.
However, if I just use the list as a collection in its own right, it detects when a change is made, but not that the change increased the length of the list. If you add text that has capital letters you'll see them get sorted correctly, but the lower list retains its prior count. The choice of a List initializer with the model versus an inner ForEach doesn't change the outcome, btw.
If I cast that type as an Array(), effectively copying its contents, it works fine which leads me to believe there is some additional Array protocol conformance that I'm missing, but that would be unfortunate since I'm not sure how I would have known that. Any ideas what's going on here? The new type can be used with for-in scenarios fine and compiles great with List/ForEach, but has this issue. I'd like the type to not require extra nonsense to be used like an array here.
import SwiftUI
fileprivate struct _VExpObservable6: View {
@Binding var model: ExpModel
@State private var text: String = ""
var body: some View {
NavigationStack {
VStack(spacing: 20) {
Spacer()
.frame(height: 40)
HStack {
TextField("Item", text: $text)
.textFieldStyle(.roundedBorder)
.textContentType(.none)
.textCase(.none)
Button("Add Item") {
guard !text.isEmpty else { return }
model.addItem(text)
text = ""
print("updated model #2 using \(Array(model.indices)):")
for s in model {
print("- \(s)")
}
}
}
InnerView(model: model)
OuterView(model: model)
}
.listStyle(.plain)
.padding()
}
}
}
// - displays the model data using an inner property expressed as
// a collection.
fileprivate struct InnerView: View {
let model: ExpModel
var body: some View {
VStack {
Text("Model Inner Collection:")
.font(.title3)
List {
ForEach(model.sorted, id: \.self) { item in
Text("- \(item)")
}
}
.border(.darkGray)
}
}
}
// - displays the model using the model _as the collection_
fileprivate struct OuterView: View {
let model: ExpModel
var body: some View {
VStack {
Text("Model as Collection:")
.font(.title3)
// - the List/ForEach collections do not appear to work
// by default using the @Observable model (RandomAccessCollection)
// itself, unless it is cast as an Array here.
List {
// ForEach(Array(model), id: \.self) { item in
ForEach(model, id: \.self) { item in
Text("- \(item)")
}
}
.border(.darkGray)
}
}
}
#Preview {
@Previewable @State var model = ExpModel()
_VExpObservable6(model: $model)
}
@Observable
fileprivate final class ExpModel: RandomAccessCollection {
typealias Element = String
var startIndex: Int { 0 }
var endIndex: Int { sorted.count }
init() {
_listData = ["apple", "yellow", "about"]
}
subscript(_ position: Int) -> String {
sortedData()[position]
}
var sorted: [String] {
sortedData()
}
func addItem(_ item: String) {
_listData.append(item)
_sorted = nil
}
private var _listData: [String]
private var _sorted: [String]?
private func sortedData() -> [String] {
if let ret = _sorted { return ret }
let ret = _listData.sorted()
_sorted = ret
return ret
}
}
My app allows to save user-selected URLs in a list and browse them with a tap. A user reported that the app often shows that when browsing their saved entry for "On My iPad", it's apparently empty (it contains no files).
I saved "On My iPad" in my own list some time ago and noticed that the same issue occurs. The URL seems to be correctly resolved from the saved bookmark data, but I noticed that url.startAccessingSecurityScopedResource() returns false. The other URL I saved some time ago is iCloud Drive, which I can access without issues. If I select "On My iPad" again in a file importer, create new bookmark data from it and resolve the URL from it, access works correctly.
I create bookmark data like this:
let data = try url.bookmarkData(includingResourceValuesForKeys: [.localizedNameKey, .pathKey, .volumeIsLocalKey])
and resolve URLs like this:
let url = try URL(resolvingBookmarkData: data, bookmarkDataIsStale: &bookmarkDataIsStale)
bookmarkDataIsStale is false for both the working and not working URLs for "On My iPad". The two bookmark data are different though, even if url.path is the same.
What could be the issue?
Introduction:
I’m encountering a consistent crash in production on iOS 26.2 (build 23C55). The crash occurs deep within libicucore when calling [NSDateFormatter dateFromString:].
Crash Summary:
Exception Type: SIGSEGV (SEGV_ACCERR)
Fault Address: 0xffffffff
Thread: Crashed on Main Thread (Thread 0)
Library: libicucore.A.dylib
Code Snippet:
The crash is triggered by the following method. It converts a string to an NSDate using a specific format and locale:
// 获取日期date
- (NSDate *)getDateWithTime:(NSString *)time formatter:(NSString *)formatterStr {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:formatterStr];
formatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
return [formatter dateFromString:time];
}
Backtrace:
Here is the relevant part of the crash report:
Incident Identifier: E24485B6-C53E-4115-A6CF-A7E4A952AD50
CrashReporter Key: 21FAC1CF-F56B-409A-98AA-351D3D2EB06C
Hardware Model: iPhone18,2
Code Type: ARM-64
Parent Process: [1]
Date/Time: 2026-01-12T01:32:25Z
OS Version: iPhone OS 26.2 (23C55)
Report Version: 105
SDK Version: 0.0.4
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0xffffffff
Crashed Thread: 0
Thread 0 Crashed:
0 libicucore.A.dylib 0x000000019b81def8 0x19b74a000 + 868088
1 libicucore.A.dylib 0x000000019b7da91c 0x19b74a000 + 592156
2 libicucore.A.dylib 0x000000019b8d8340 0x19b74a000 + 1631040
3 libicucore.A.dylib 0x000000019b8eae18 0x19b74a000 + 1707544
4 libicucore.A.dylib 0x000000019b8eb600 0x19b74a000 + 1709568
5 libicucore.A.dylib 0x000000019b878be4 0x19b74a000 + 1240036
6 libicucore.A.dylib 0x000000019b87ae84 0x19b74a000 + 1248900
7 libicucore.A.dylib 0x000000019b87b2dc 0x19b74a000 + 1250012
8 libicucore.A.dylib 0x000000019b9564ac 0x19b74a000 + 2147500
9 libicucore.A.dylib 0x000000019b954afc 0x19b74a000 + 2140924
10 libicucore.A.dylib 0x000000019b952794 0x19b74a000 + 2131860
11 libicucore.A.dylib 0x000000019b98689c 0x19b74a000 + 2345116
12 CoreFoundation 0x00000001895dbfe0 0x18953d000 + 651232
13 CoreFoundation 0x00000001895dbaa0 0x18953d000 + 649888
14 Foundation 0x0000000186d2029c 0x186b88000 + 1671836
15 Foundation 0x00000001874a62dc 0x186b88000 + 9560796
16 Foundation 0x00000001874a6384 0x186b88000 + 9560964
17 xxxx 0x0000000105ea6e30 -[xxxxx getDateWithTime:formatter:] + 168
and
Thread 0 crashed with ARM-64 Thread State:
pc: 0x000000019b81def8 fp: 0x000000016f96bc10 sp: 0x000000016f96bbd0 x0: 0x00000000ffffffff
x1: 0x000000019ba1e8e0 x2: 0x0000000000000002 x3: 0x000000000000000b x4: 0x0000000000000074
x5: 0x0000000000000069 x6: 0x0000000000000000 x7: 0xfffff0003ffff800 x8: 0x000000009ba18014
x9: 0x00000001148dffd0 x10: 0x0000000000000002 x11: 0x0000000000000004 x12: 0x0000000000000220
x13: 0x0000000000000030 x14: 0x000000015b6f36b8 x15: 0x000000015cfe0000 x16: 0x00000002a19d0ff0
x17: 0x00000001f5590a70 x18: 0x0000000000000000 x19: 0x000000016f96bc30 x20: 0x0000000000000000
x21: 0x000000015cfe3200 x22: 0x000000019ba18014 x23: 0x0000000000000000 x24: 0x000000015cfe32a0
x25: 0x0000000000000003 x26: 0x0000000000000000 x27: 0x0000000000000000 x28: 0x000000015cfe3200
lr: 0x000000019b7da958 cpsr: 0x00000000a0000000
Topic:
App & System Services
SubTopic:
General
Tags:
Foundation
iOS
Objective-C
Internationalization
There are many units which are inverse of standard units, e.g. wave period vs Hz, pace vs speed, Siemens vs Ohms, ...
Dimension can be subclassed to create the custom units.
How to extend Measurement.converted( to: )?
I was looking at somehow using UnitConverter and subclass to something like UnitConverterInverse.
Thoughts?
On iOS 18 and lower version, my application supports automatically switching to [System settings - Personal Hotspot] directly. But on iOS 26, my application will be redirected to [System settings- Apps].
Does iOS 26 disable the behavior of directly jumping to the system hotspot page? If support, could you share the API for iOS 26?
iOS Intermittent Bug: UserDefaults Preferences Loading Issue
Problem Summary
We're experiencing an intermittent issue where UserPreferences.shared.preferences returns inconsistent values even after calling getPreferences(). The behavior is unpredictable and affects critical functionality.
Environment
iOS Version: 15+
Language: Objective-C with Swift interop
Storage: UserDefaults with App Group (group.com.jci.tyco.glss)
Architecture: Singleton pattern for UserPreferences (Swift class)
The Issue
When a push notification arrives and triggers the showEvent: method, user preferences are sometimes loaded correctly and sometimes return nil or default values:
Scenario A (Works - ~60% of time):
Scenario B (Fails - ~40% of time):
Observed Pattern
From extensive logging over multiple test runs:
Key Observation:
At app launch: Preferences often load successfully
Seconds later when push arrives: Same preferences become unavailable
User navigates to another screen and back: Preferences suddenly work again
Code Structure
Objective-C AppDelegate.m
- (void)showEvent:(FMEvent *)event eventReadSource:(FMEventReadSourceType)eventSource {
BOOL isUserRoleEndUser = [[FMUserRolesRepository instance] userRoleAvailable:FMUserRoleEndUser];
UserPreferences *userPrefs = [UserPreferences shared];
[userPrefs getPreferences]; // ← Called here
// Immediately after, sometimes nil!
bool hasFireAudio = [userPrefs.preferences.fireAudio.lowercaseString isEqual:@"true"];
NSLog(@"isUserRoleEndUser: %d | Fire Audio: %d", isUserRoleEndUser, hasFireAudio);
// Decision logic based on preferences
if ([FMConstants getUserRegion] == UserRegionUK &&
isUserRoleEndUser &&
userPrefs.preferences && // ← Sometimes nil here
hasFireAudio) {
// Show Screen A
} else {
// Show Screen B
}
}
```class UserPreferences: NSObject {
static let shared = UserPreferences()
var preferences: FMUserPreferencesInfo? // ← This becomes nil intermittently
func getPreferences() {
let userDefaults = UserDefaults(suiteName: "group.com.jci.tyco.glss")
if let data = userDefaults?.data(forKey: "UserPreferences") {
// Decode and set preferences
self.preferences = // decoded object
} else {
// Create default preferences with fireAudio = "false"
self.preferences = FMUserPreferencesInfo()
}
}
}
Is there any way to forcibly disable using QUIC? I've noticed this ends up causing issues with our ISP / router, and noticed for many of our customers as well.
Creating an ephemeral session doesn't change things, and setting the request to "assumeHttp3Capable" to false doesn't fix things either.
We are using Cloudflare Workers as the URL we are hitting, and thus aren't able to disable this server-side.
I am currently encountering a problem: during the process of uploading a large file, I have moved the file that was not successfully uploaded to the trash can. These two operations have been tested to be serial (triggering the 'create Item' callback first, followed by the 'modify Item' callback), which means that the file must be uploaded before it can be moved to the recycle bin (which can also result in the file being stored in the cloud recycle bin). I want to implement: directly interrupt this upload process and then do not complete the upload. How can I achieve this? Please help me. Thank you
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Foundation
Swift
File Provider
Files and Storage
A user of one of my apps reported that since the update to macOS 26.1 they are no longer able to scan Macintosh HD: the app used to work, but now always reports that Macintosh HD contains a single empty file named .nofollow, or rather the path is resolved to /.nofollow.
Initially I thought this could be related to resolving the file from the saved bookmark data, but even restarting the app and selecting Macintosh HD in an open panel (without resolving the bookmark data) produces the same result.
The user tried another app of mine with the same issue, but said that they were able to scan Macintosh HD in other App Store apps. I never heard of this issue before and my apps have been on the App Store for many years, but it looks like I might be doing something wrong, or the APIs that I use are somehow broken. In all my apps I currently use getattrlistbulk because I need attributes that are not available as URLResourceKey in all supported operating system versions.
What could be the issue? I'm on macOS 26.1 myself and never experienced it.
I try saving the value of NSURLVolumeURLKey when creating a bookmark. When resolving the bookmark later I pass the bookmark data to +resourceValuesForKeys:fromBookmarkData: but always pull out "file:///" which is wrong.
In contrast the value for NSURLVolumeURLForRemountingKey is properly saved and restored using the same method.
Recently I noticed an app called “Lookus”. Even if I force‑kill it, it still seems to obtain information such as my charging status and network status, and it can even send real‑time notifications. I’m curious how this is technically possible. Does anyone know how this could be achieved?
I have an Xcode app where currently txt files in the project display text data as a list. I can search through the lists and have buttons that will swap between different lists of information that you can look through.
The next task is I have URL connections to docx files on a SharePoint site. I am trying to use an URLsession function to connect to the URL links to download the documents to the document directory then have the application read the doc information to then be displayed as the txt info would.
The idea is that the docx files are a type of online update version of the data. So when the app is used and on wifi, the app can update the list data with the docx files.
I have code set up that should access the URL files but I am struggling to figure out how to read the data and access from this Documents directory. I have been looking online and so far I am at a loss on where to go here.
If anyone can help or provide some insight I would greatly appreciate it.
I can try and provide code samples to help explain things if that is needed.
"We are developing an application use case that requires us to prompt the user to restart their device. We plan to use the system uptime value provided by [NSProcessInfo processInfo].systemUptime to determine if a restart has occurred. Apple's documentation defines this API as 'The amount of time the system has been awake since the last time it was restarted.'
Our questions are:
Can we reliably use this API, in conjunction with persistent storage, to detect a device restart?
Are there any known limitations or considerations when accessing or relying on this API while the application is running in the background?"
With the RC version of macOS 26, an issue persists when you try to create a bookmark with security scope for the root folder "/". This leads to an error "The file couldn’t be opened.". However, you can create bookmark for /Applications, /System, /Users...
This is quite annoying for one of my app because a user can create a cartography of his disk usage, and the access to the root folder "/" is the only way to do so!
Is there a workaround?
PS: reported the issue with ID FB20186406
let openPanel = NSOpenPanel()
openPanel.canChooseDirectories = true
openPanel.canChooseFiles = false
openPanel.beginSheetModal(for: self.view.window!) { (result) in
guard result == .OK, let folderURL = openPanel.url else {
return
}
openPanel.close()
do {
let data = try folderURL.bookmarkData(options: .withSecurityScope, includingResourceValuesForKeys: nil, relativeTo: nil)
print("Bookmark data was created for \(folderURL.path)")
} catch (let error) {
print("Error creating bookmark for \(folderURL.path), with error: \(error.localizedDescription)")
}
}
I've experimentally seen that the notifications(named:) API of NotificationCenter appears to buffer observed notifications internally. In local testing it appears to be limited to 8 messages. I've been unable to find any documentation of this fact, and the behavior seems like it could lead to software bugs if code is not expecting notifications to potentially be dropped. Is this behavior expected and documented somewhere?
Here is a sample program demonstrating the behavioral difference between the Combine and AsyncSequence-based notification observations:
@Test
nonisolated func testNotificationRace() async throws {
let testName = Notification.Name("TestNotification")
let notificationCount = 100
var observedAsyncIDs = [Int]()
var observedCombineIDs = [Int]()
let subscribe = Task { @MainActor in
print("setting up observer...")
let token = NotificationCenter.default.publisher(for: testName)
.sink { value in
let id = value.userInfo?["id"] as! Int
observedCombineIDs.append(id)
print("🚜 observed note with id: \(id)")
}
defer { extendLifetime(token) }
for await note in NotificationCenter.default.notifications(named: testName) {
let id: Int = note.userInfo?["id"] as! Int
print("🚰 observed note with id: \(id)")
observedAsyncIDs.append(id)
if id == notificationCount { break }
}
}
let post = Task { @MainActor in
for i in 1...notificationCount {
NotificationCenter.default.post(
name: testName,
object: nil,
userInfo: ["id": i]
)
}
}
_ = await (post.value, subscribe.value)
#expect(observedAsyncIDs.count == notificationCount) // 🛑 Expectation failed: (observedAsyncIDs.count → 8) == (notificationCount → 100)
#expect(observedCombineIDs == Array(1...notificationCount))
print("done")
}
I have an iOS app with ExtensionFoundation. It runs well on my local device, but when I upload on the AppStore it gets rejected with:
Validation failed
Invalid Info.plist value. The value of the EXExtensionPointIdentifier key, AsheKube.app.a-Shell.localWebServer, in the Info.plist of “a-Shell.app/Extensions/localWebServer.appex” is invalid. Please refer to the App Extension Programming Guide at https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Action.html#/apple_ref/doc/uid/TP40014214-CH13-SW1. (ID: ae8dd1dd-8caf-4a48-9651-7a225faed4eb)
The Info.plist in my Extension is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EXAppExtensionAttributes</key>
<dict>
<key>EXExtensionPointIdentifier</key>
<string>com.example.example-extension</string>
</dict>
</dict>
</plist>
so the Info.plist that causes the issue has been automatically generated by Xcode. I can access it as well, and it says:
{
"BuildMachineOSBuild" => "25A354"
"CFBundleDevelopmentRegion" => "en"
"CFBundleDisplayName" => "localWebServerExtension"
"CFBundleExecutable" => "localWebServer"
"CFBundleIdentifier" => "AsheKube.app.a-Shell.localWebServerExtension"
"CFBundleInfoDictionaryVersion" => "6.0"
"CFBundleName" => "localWebServer"
"CFBundlePackageType" => "XPC!"
"CFBundleShortVersionString" => "1.0"
"CFBundleSupportedPlatforms" => [
0 => "iPhoneOS"
]
"CFBundleVersion" => "1"
"DTCompiler" => "com.apple.compilers.llvm.clang.1_0"
"DTPlatformBuild" => "23A339"
"DTPlatformName" => "iphoneos"
"DTPlatformVersion" => "26.0"
"DTSDKBuild" => "23A339"
"DTSDKName" => "iphoneos26.0"
"DTXcode" => "2601"
"DTXcodeBuild" => "17A400"
"EXAppExtensionAttributes" => {
"EXExtensionPointIdentifier" => "AsheKube.app.a-Shell.localWebServer"
}
"MinimumOSVersion" => "26.0"
"NSHumanReadableCopyright" => "Copyright © 2025 AsheKube. All rights reserved."
"UIDeviceFamily" => [
0 => 1
1 => 2
]
"UIRequiredDeviceCapabilities" => [
0 => "arm64"
]
}
What should I do to be able to upload on the AppStore?
The API we used:
NSURL *url = [NSURL URLWithString:@"App-Prefs:INTERNET_TETHERING"];
The link provided by Apple engineer:
https://developer.apple.com/forums/thread/761314
I did not find any URL in the link that leads to the secondary menu of system settings. Does this suggest that iOS 26 does not support this functionality? Moreover, is it possible that versions of iOS 18 and earlier may also not support this behavior in the future?
After switching our iOS app project from Swift 5 to Swift 6 and publishing an update, we started seeing a large number of crashes in Firebase Crashlytics.
The crashes are triggered by NotificationCenter methods (post, addObserver, removeObserver) and show the following error:
BUG IN CLIENT OF LIBDISPATCH: Assertion failed: Block was expected to execute on queue [com.apple.main-thread (0x1f9dc1580)]
All scopes to related calls are already explicitly marked with @MainActor. This issue never occurred with Swift 5, but appeared immediately after moving to Swift 6.
Has anyone else encountered this problem? Is there a known solution or workaround?
Thanks in advance!
Hi,
I'm experiencing intermittent delays with URLSession where requests take 3-4 seconds to be sent, even though the actual server processing is fast. This happens randomly, maybe 10-20% of requests.
The pattern I've noticed is
I create my request
I send off my request using try await urlSession.data(for: request)
My middleware ends up receiving this request 4-7s after its been fired from the client-side
The round trip ends up taking 4-7s!
This hasn't been reproducible consistently at all on my end. I've also tried ephemeral URLSessions (so recreating the session instead of using .shared so no dead connections, but this doesn't seem to help at all)
Completely lost on what to do. Please help!