same error here for a fresh new app. all fields are completed.
Post
Replies
Boosts
Views
Activity
Found the error! I could submit now!
The copyright field is now required!
This must be new! Didn't have this problem two weeks ago. Wished the error message would have been clearer!
Hi !
I am using standard URLSession . no custom ATS settings. I can be reproduced with all fresh created apps in Xcode 15.
struct ContentView: View {
@StateObject var client = NetworkClient()
@State var text: String
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text(text)
}.task {
do {
let res = try await client.request()
self.text = res
} catch {}
}
.padding()
}
}
class NetworkClient: ObservableObject {
func request() async throws -> String {
let (data, _) = try await URLSession.shared.data(for: .init(url: .init(string: "https://www.apple.com")!))
return String(data: data, encoding: .utf8) ?? "empty"
}
}
thanks for the hint
Any updates on this crash / fix / rdar? We are also seeing this crash. Even when the app is in foreground. It happens randomly. Hard to reproduce.
For details , see my attached crash log
2024-04-22_14-55-46.3894_+0200-498fa0a5137ba58fc535e918e393ed2c2efa174a.crash
The interesting part is in 2 CFNetwork 0x00000001895e6c58 _BrowserCancel(__CFNetServiceBrowser*) + 120 (CFNetServiceBrowser.c:179)
which can be opened here:
https://opensource.apple.com/source/CFNetwork/CFNetwork-129.18/NetServices/CFNetServiceBrowser.c.auto.html
/* static */ void
_BrowserCancel(__CFNetServiceBrowser* browser) {
CFNetServiceBrowserClientCallBack cb = NULL;
CFStreamError error;
void* info = NULL;
// Retain here to guarantee safety really after the browser release,
// but definitely before the callback.
CFRetain(browser);
// Lock the browser
__CFSpinLock(&browser->_lock);
// If the browse canceled, don't need to do any of this.
if (browser->_trigger) {
// Save the callback if there is one at this time.
cb = browser->_callback;
// Save the error and client information for the callback
memmove(&error, &(browser->_error), sizeof(error));
info = browser->_client.info;
// Remove the trigger from run loops and modes
_CFTypeUnscheduleFromMultipleRunLoops(browser->_trigger, browser->_schedules);
// Invalidate the run loop source that got here
CFRunLoopSourceInvalidate((CFRunLoopSourceRef)(browser->_trigger));
// Release the trigger now.
CFRelease(browser->_trigger);
browser->_trigger = NULL;
}
// Unlock the browser so the callback can be made safely.
__CFSpinUnlock(&browser->_lock);
// If there is a callback, inform the client of the finish.
if (cb)
cb((CFNetServiceBrowserRef)browser, 0, NULL, &error, info);
// Go ahead and release now that the callback is done.
CFRelease(browser);
}
the CFRunLoopSourceInvalidate causes the crash? There is a lock. But might be not correct?
sure. see the sample here. BuildingView will load all rows (i.e. 1000 instead of 17)
struct ContentView: View {
@StateObject var store = Store()
var body: some View {
TabView {
// Correct
houses.tabItem {
Label("Houses", systemImage: "house")
}
// Wrong?
buildings.tabItem {
Label("Building", systemImage: "building")
}
}
}
var houses: some View {
List {
ForEach(store.houses) {house in
HouseView(house: house)
}
}
}
var buildings: some View {
List {
ForEach(store.buildings) {building in
BuildingView(building: building)
}
}
}
}
struct HouseView: View {
let house: House
var body: some View {
print(house.title) // Only visible will get loaded
return Text(house.title)
}
}
struct BuildingView: View {
let building: Building
var body: some View {
print(building.index) // loads all available items
return content
}
@ViewBuilder
var content: some View {
switch building.kind {
case .condo:
Text("Condo \(building.index)")
case .house:
Text("House \(building.index)")
case .warehouse:
Text("Warehouse \(building.index)")
}
}
}
any idea here?