Post

Replies

Boosts

Views

Activity

Foundation _userInfoForFileAndLine crash
Could anyone give some insights to identify the root cause for this crash? Fatal Exception: NSInternalInconsistencyException Layout requested for visible navigation bar, <UINavigationBar: 0x120e74280; frame = (0 0; 430 56); autoresize = W; tintColor = <UIDynamicProviderColor: 0x300488b20; provider = <__NSMallocBlock__: 0x300a60900>>; layer = <CALayer: 0x3000f0380>> delegate=0x1277a4600 standardAppearance=0x302d5c770 scrollEdgeAppearance=0x302d5d500, when the top item belongs to a different navigation bar. topItem = <UINavigationItem: 0x10a7d8500> title='Transfers' style=navigator leftBarButtonItems=0x300690020 rightBarButtonItems=0x300613ff0, navigation bar = <UINavigationBar: 0x11a8ef200; frame = (0 0; 430 44); opaque = NO; autoresize = W; layer = <CALayer: 0x3002a44c0>> delegate=0x1277a0c00, possibly from a client attempt to nest wrapped navigation controllers. ==== Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x827cc __exceptionPreprocess 1 libobjc.A.dylib 0x172e4 objc_exception_throw 2 Foundation 0x80f8d8 _userInfoForFileAndLine 3 UIKitCore 0x2b63e8 -[UINavigationBar layoutSubviews] 4 UIKitCore 0xd688 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] 5 UIKitCore 0x14dc14 -[UINavigationBar layoutSublayersOfLayer:] 6 QuartzCore 0x78c28 CA::Layer::layout_if_needed(CA::Transaction*) 7 QuartzCore 0x787b4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) 8 QuartzCore 0xcf914 CA::Context::commit_transaction(CA::Transaction*, double, double*) 9 QuartzCore 0x4e7c4 CA::Transaction::commit() 10 QuartzCore 0x91a0c CA::Transaction::flush_as_runloop_observer(bool) 11 UIKitCore 0xa3568 _UIApplicationFlushCATransaction 12 UIKitCore 0xa0b64 __setupUpdateSequence_block_invoke_2 13 UIKitCore 0xa09d8 _UIUpdateSequenceRun 14 UIKitCore 0xa0628 schedulerStepScheduledMainSection 15 UIKitCore 0xa159c runloopSourceCallback 16 CoreFoundation 0x56328 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 17 CoreFoundation 0x562bc __CFRunLoopDoSource0 18 CoreFoundation 0x53dc0 __CFRunLoopDoSources0 19 CoreFoundation 0x52fbc __CFRunLoopRun 20 CoreFoundation 0x52830 CFRunLoopRunSpecific 21 GraphicsServices 0x11c4 GSEventRunModal 22 UIKitCore 0x3d2eb0 -[UIApplication _run] 23 UIKitCore 0x4815b4 UIApplicationMain 24 XX 0xa0f64 main + 7 (main.m:7) 25 ??? 0x1abb6eec8 (Missing)
0
0
82
3d
Strange crash when using .values from @Published publisher
Given the below code with Swift 6 language mode, Xcode 16.2 If running with iOS 18+: the app crashes due to _dispatch_assert_queue_fail If running with iOS 17 and below: there is a warning: warning: data race detected: @MainActor function at Swift6Playground/PublishedValuesView.swift:12 was not called on the main thread Could anyone please help explain what's wrong here? import SwiftUI import Combine @MainActor class PublishedValuesViewModel: ObservableObject { @Published var count = 0 @Published var content: String = "NA" private var cancellables: Set<AnyCancellable> = [] func start() async { let publisher = $count .map { String(describing: $0) } .removeDuplicates() for await value in publisher.values { content = value } } } struct PublishedValuesView: View { @ObservedObject var viewModel: PublishedValuesViewModel var body: some View { Text("Published Values: \(viewModel.content)") .task { await viewModel.start() } } }
2
0
99
4d