Post

Replies

Boosts

Views

Activity

iPhone Duo side bar is empty after a full-screen modal closes, when a child UITabBarController is sized with Auto Layout
Hi, On iPhone Duo, the vertical tab bar (side bar) shows no tabs after a full-screen modal closes. This happens when the device opened while the modal showed. I filed it as FB25719774. Environment: Xcode 27.2, iPhone Duo simulator, iOS 27.2 (24B91016s). Setup: A container view controller holds a UITabBarController as a child. Auto Layout constraints pin the child view to the 4 edges of the container. override func viewDidLoad() { super.viewDidLoad() addChild(child) child.view.translatesAutoresizingMaskIntoConstraints = false view.addSubview(child.view) NSLayoutConstraint.activate([ child.view.topAnchor.constraint(equalTo: view.topAnchor), child.view.leadingAnchor.constraint(equalTo: view.leadingAnchor), child.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), child.view.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) child.didMove(toParent: self) }Steps: Fold the device. The side bar shows 4 tabs. Present a view controller with modalPresentationStyle = .fullScreen. While the modal shows, open the device flat. Close the modal. Expected: The side bar shows the 4 tabs, as it did before the modal. Actual: The side bar is empty. The child gets the right frame one layout pass later. But the side bar stays empty, even though tabBar is not hidden and has a normal frame. Workaround: Size the child view with an autoresizing mask while the container is off the window: child.view.frame = view.bounds child.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]However, we could not use the mask all the time. On iOS 17.5, it caused a second issue: after a rotation, a compositional layout inside the child kept the old size classes (FB25719805). So we turn on the mask only while the container is off the window. Related: FB25261013 (https://developer.apple.com/forums/thread/852478) shows the same empty side bar. There, the UITabBarController is added as a child with constraints while the Duo is open. In both cases, Auto Layout has not updated the child frame yet when UIKit sets up the side bar. Link to demo project here: https://transfer.it/t/jd07S2pjxb6A
0
0
182
3d
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)
1
0
1.2k
Jan ’25
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
1.1k
Dec ’24
iPhone Duo side bar is empty after a full-screen modal closes, when a child UITabBarController is sized with Auto Layout
Hi, On iPhone Duo, the vertical tab bar (side bar) shows no tabs after a full-screen modal closes. This happens when the device opened while the modal showed. I filed it as FB25719774. Environment: Xcode 27.2, iPhone Duo simulator, iOS 27.2 (24B91016s). Setup: A container view controller holds a UITabBarController as a child. Auto Layout constraints pin the child view to the 4 edges of the container. override func viewDidLoad() { super.viewDidLoad() addChild(child) child.view.translatesAutoresizingMaskIntoConstraints = false view.addSubview(child.view) NSLayoutConstraint.activate([ child.view.topAnchor.constraint(equalTo: view.topAnchor), child.view.leadingAnchor.constraint(equalTo: view.leadingAnchor), child.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), child.view.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) child.didMove(toParent: self) }Steps: Fold the device. The side bar shows 4 tabs. Present a view controller with modalPresentationStyle = .fullScreen. While the modal shows, open the device flat. Close the modal. Expected: The side bar shows the 4 tabs, as it did before the modal. Actual: The side bar is empty. The child gets the right frame one layout pass later. But the side bar stays empty, even though tabBar is not hidden and has a normal frame. Workaround: Size the child view with an autoresizing mask while the container is off the window: child.view.frame = view.bounds child.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]However, we could not use the mask all the time. On iOS 17.5, it caused a second issue: after a rotation, a compositional layout inside the child kept the old size classes (FB25719805). So we turn on the mask only while the container is off the window. Related: FB25261013 (https://developer.apple.com/forums/thread/852478) shows the same empty side bar. There, the UITabBarController is added as a child with constraints while the Duo is open. In both cases, Auto Layout has not updated the child frame yet when UIKit sets up the side bar. Link to demo project here: https://transfer.it/t/jd07S2pjxb6A
Replies
0
Boosts
0
Views
182
Activity
3d
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)
Replies
1
Boosts
0
Views
1.2k
Activity
Jan ’25
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() } } }
Replies
2
Boosts
0
Views
1.1k
Activity
Dec ’24