A slightly more complex code snippet works:
let session = URLSession.shared
let config = URLSessionConfiguration.background(withIdentifier: "SESSION_ID")
config.sessionSendsLaunchEvents = true
let backgroundSession = URLSession(configuration: config)
let response = await withTaskCancellationHandler {
try? await session.data(for: request)
} onCancel: {
let task = backgroundSession.downloadTask(with: request))
task.resume()
}
Post
Replies
Boosts
Views
Activity
An Apple engineer resolved the issue for me in response to a FeedbackReport. Here was the problem, and a solution. Xcode 16 appears to have changed the header search behavior. My project was structured something like this:
Project.xcworkspace
Project.xcproject
/Project \App <---- Folder containing all app source code
/Development Sample Code <---- Folder containing ctype.h reference
On Xcode 15.4, the headers in /Development Sample Code were not search, they appear to be in Xcode 16.
The resolution was to move the /Development Sample Code folder to a different location. And in general, you can search for files containing 'ctype.h' and remove them from the project folder.