I had take screenshots by following code
let scenes = UIApplication.shared.connectedScenes
let windowScene = scenes.first as? UIWindowScene
let window = windowScene?.windows.first
self.uiImage = window?.rootViewController?.view!.getImage(rect: rect)
View has two views. One is ImageView contains some image and overlay of image detection results with .overlay. another view is InfoView contains several info and button which above code fired. on iOS 17, I can take screenshots as I saw, but on iOS26, missing on image of ImageView. Overlay(detected rectangle) in Imageview and InfView can be taken.
How can I take screenshots as I saw on iOS26?(iPad)
UIKit
RSS for tagConstruct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.
Posts under UIKit tag
200 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
When using UITraitBridgedEnvironmentKey to pass a trait value to the swift environment, it causes a crash when trying to access the value from the environment.
The issue seems to be related to how swift uses the UITraitBridgedEnvironmentKey protocol since the crash occurs in swift::_getWitnessTable () from lazy protocol witness table accessor…. It can occur when calling any function that is generic using the UITraitBridgedEnvironmentKey type.
I originally encountered the issue when trying to use a UITraitBridgedEnvironmentKey in SwiftUI, but have been able to reproduce the issue with any function with a similar signature.
https://developer.apple.com/documentation/swiftui/environmentvalues/subscript(_:)-9zku
Steps to Reproduce
Requirements for the issue to occur
Project with a minimum iOS version of iOS 16
Build the project with Xcode 26
Run on iOS 18
Add the following code to a project and call foo(key: MyCustomTraitKey.self) from anywhere.
@available(iOS 17.0, *)
func foo<K>(key: K.Type) where K: UITraitBridgedEnvironmentKey {
// Crashes before this is called
}
@available(iOS 17.0, *)
public enum MyCustomTraitKey: UITraitBridgedEnvironmentKey {
public static let defaultValue: Bool = false
public static func read(from traitCollection: UITraitCollection) -> Bool { false }
public static func write(to mutableTraits: inout UIMutableTraits, value: Bool) {}
}
// The crash will occur when calling this. It can be added to a project anywhere
// The sample project calls it from scene(_:willConnectTo:options:)
foo(key: MyCustomTraitKey.self)
For example, I added it to the SceneDelegate in a UIKit Project
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if #available(iOS 17, *) {
// The following line of code can be placed anywhere in a project, `SceneDelegate` is just a convenient place to put it to reproduce the issue.
foo(key: MyCustomTraitKey.self)
// ^ CRASH: Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)
}
}
}
Actual Behaviour
The app crashes with the stack trace showing the place calling foo but before foo is actually called. (ie, a breakpoint or print in foo is never hit)
#0 0x000000019595fbc4 in swift::_getWitnessTable ()
#1 0x0000000104954128 in lazy protocol witness table accessor for type MyCustomTraitKey and conformance MyCustomTraitKey ()
#2 0x0000000104953bc4 in SceneDelegate.scene(_:willConnectTo:options:) at .../SceneDelegate.swift:20
The app does not crash when run on iOS 17, or 26 or when the minimum ios version is raised to iOS 17 or higher.
It also doesn't crash on iOS 16 since it's not calling foo since UITraitBridgedEnvironmentKey was added in iOS 17.
Expected behaviour
The app should not crash. It should call foo on iOS 17, 18, and 26.
Platform
UIKit
iOS
UIActivityViewController
Environment
Device (issue reported): iPhone 16
iOS Version: 26.2
App Type: UIKit / Swift (standard modal presentation of UIActivityViewController)
Summary
When presenting UIActivityViewController to share a CSV file, the share sheet does not allow vertical scrolling, making lower actions (including Save to Files) unreachable.
The same flow works correctly when sharing a PDF, and the issue cannot be reproduced on other test devices.
Steps to Reproduce
Launch the app and log in
Navigate to More → Reports
Tap Export Report
Choose Export Report (CSV)
Observe the share sheet
Expected Result
The user should be able to vertically scroll the share sheet
All share actions (including Save to Files) should be reachable
Actual Result
Share sheet opens but vertical scrolling is disabled
Lower options (including Save to Files) are not reachable
No crash or console errors
Our app supports UIScene. As a result, launchOptions in application(_:didFinishLaunchingWithOptions:) is always nil.
However, the documentation mentions that UIApplication.LaunchOptionsKey.location should be present when the app is launched due to a location event.
Given that our app is scene-based:
How can we reliably determine whether the app was launched due to a location update, geofence, or significant location change?
Is there a recommended pattern or API to detect this scenario in a Scene-based app lifecycle?
This information is critical for us to correctly initialize location-related logic on launch.
Relevant documentation:
https://developer.apple.com/documentation/corelocation/cllocationmanager/startmonitoringsignificantlocationchanges()
1. Summary
In a hybrid iOS app using WKWebView (Angular + Capacitor), after programmatically blurring an element and connecting a Bluetooth keyboard, pressing Ctrl+Home or Ctrl+End causes the app to crash.
The crash stack shows the issue occurs inside UIKit keyboard handling (UITextInteractionSelectableInputDelegate _moveToStartOfLine), indicating a system-level bug.
2. Steps to Reproduce
Open the hybrid app containing a WKWebView.
Blur the input (programmatically).
Connect a Bluetooth keyboard.
Press Ctrl + Home or Ctrl + End.
Expected result:
No crash. The command should be ignored if no text input is active.
Actual result:
App crashes immediately.
3. Crash Log (Crashlytics Trace)
Crashed: com.apple.main-thread
0 WebKit 0xfbdad0 <redacted> + 236
1 UIKitCore 0x10b0548 -[UITextInteractionSelectableInputDelegate _moveToStartOfLine:withHistory:] + 96
2 UIKitCore 0xd0fb38 -[UIKBInputDelegateManager _moveToStartOfLine:withHistory:] + 188
3 UIKitCore 0xa16174 __158-[_UIKeyboardStateManager handleMoveCursorToStartOfLine:beforePublicKeyCommands:testOnly:savedHistory:force:canHandleSelectableInputDelegateCommand:keyEvent:]_block_invoke + 52
4 UIKitCore 0xa36ae4 -[_UIKeyboardStateManager performBlockWithTextInputChangesIgnoredForNonMacOS:] + 48
5 UIKitCore 0xa160f0 -[_UIKeyboardStateManager handleMoveCursorToStartOfLine:beforePublicKeyCommands:testOnly:savedHistory:force:canHandleSelectableInputDelegateCommand:keyEvent:] + 440
6 UIKitCore 0xa06614 -[_UIKeyboardStateManager handleKeyCommand:repeatOkay:options:] + 3204
7 UIKitCore 0xa2fb64 -[_UIKeyboardStateManager _handleKeyCommandCommon:options:] + 76
8 UIKitCore 0xa2fb08 -[_UIKeyboardStateManager _handleKeyCommand:] + 20
9 UIKitCore 0xa30684 -[_UIKeyboardStateManager handleKeyEvent:executionContext:] + 2464
10 UIKitCore 0xa2f95c __42-[_UIKeyboardStateManager handleKeyEvent:]_block_invoke + 40
11 UIKitCore 0x4b9460 -[UIKeyboardTaskEntry execute:] + 208
12 UIKitCore 0x4b92f4 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 356
13 UIKitCore 0x4b8be0 -[UIKeyboardTaskQueue addTask:breadcrumb:] + 120
14 UIKitCore 0xa2f8d0 -[_UIKeyboardStateManager handleKeyEvent:] + 432
15 CoreFoundation 0x2f934 __invoking___ + 148
16 CoreFoundation 0x2efac -[NSInvocation invoke] + 424
17 UIKitCore 0x14cbcc4 -[UIRepeatedAction invoke] + 176
18 UIKitCore 0x14cbeb8 -[UIRepeatedAction _preInvocationTimerFire] + 56
19 UIKitCore 0x1195364 -[UIApplication _handleKeyboardPressEvent:] + 2192
20 UIKitCore 0x1187278 -[UIApplication pressesBegan:withEvent:] + 328
21 UIKitCore 0x9b808 forwardTouchMethod + 376
22 UIKitCore 0x9b808 forwardTouchMethod + 376
23 UIKitCore 0x9b808 forwardTouchMethod + 376
24 UIKitCore 0x9b808 forwardTouchMethod + 376
25 UIKitCore 0x9b808 forwardTouchMethod + 376
26 UIKitCore 0x9b808 forwardTouchMethod + 376
27 UIKitCore 0x9b808 forwardTouchMethod + 376
28 UIKitCore 0x9b808 forwardTouchMethod + 376
29 WebKit 0x66e2b4 <redacted> + 84
30 UIKitCore 0x9b808 forwardTouchMethod + 376
31 UIKitCore 0x157290c -[UIScrollView pressesBegan:withEvent:] + 148
32 UIKitCore 0x9b808 forwardTouchMethod + 376
33 WebKit 0xfbbd04 <redacted> + 100
34 UIKitCore 0x11a7620 -[UIWindow _sendButtonsForEvent:] + 312
35 UIKitCore 0x522dc -[UIWindow sendEvent:] + 568
36 UIKitCore 0x5f508 -[UIApplication sendEvent:] + 376
37 UIKitCore 0x1194364 -[UIApplication _handleKeyUIEvent:] + 136
38 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
39 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
40 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
41 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
42 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
43 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
44 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
45 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
46 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
47 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56
48 UIKitCore 0x11943e8 -[UIApplication handleKeyUIEvent:] + 56
49 UIKitCore 0x11942ac -[UIApplication _handleKeyHIDEvent:usingSyntheticEvent:] + 660
50 UIKitCore 0x117ac __dispatchPreprocessedEventFromEventQueue + 4648
51 UIKitCore 0xfbe4 __processEventQueue + 4812
52 UIKitCore 0x94e4 updateCycleEntry + 160
53 UIKitCore 0x9404 _UIUpdateSequenceRun + 84
54 UIKitCore 0x8ab4 schedulerStepScheduledMainSection + 208
55 UIKitCore 0x41e4 runloopSourceCallback + 92
56 CoreFoundation 0xf92c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
57 CoreFoundation 0xf744 __CFRunLoopDoSource0 + 172
58 CoreFoundation 0xf5a0 __CFRunLoopDoSources0 + 232
59 CoreFoundation 0xff20 __CFRunLoopRun + 840
60 CoreFoundation 0x11adc CFRunLoopRunSpecific + 572
61 GraphicsServices 0x1454 GSEventRunModal + 168
62 UIKitCore 0x135274 -[UIApplication _run] + 816
63 UIKitCore 0x100a28 UIApplicationMain + 336
64 Order 0xa2ed0 main + 21 (AppDelegate.swift:21)
4. Environment
iPadOS versions: 18.1.0, 18.4.1, 18.6.2
WebView: WKWebView
Hybrid stack: Angular + (Capacitor)
Reproducible on multiple iPads and multiple iPadOS 18.x versions.
5. Expected Behavior
Pressing Ctrl+Home or Ctrl+End when no text input is active should be ignored and should not crash the app.
Hi there. I want to use Adobe XD for designing and prototyping apps, and I would like to get the UIKit design resources working. I downloaded it and tried to open it with Adobe XD, but it threw this error:
There was an error opening the file Apple iOS 26 UI Kit.sketch
(Error code: 115)
I really prefer to use the UIKit in Adobe XD rather than paying for Figma or Sketch. Thanks.
Apple Design Resources
In iOS 26, keyboardLayoutGuide does not provide the correct constraint when using third-party input method.
A demo’s source code is attached to FB18594298 to illustrate the issue.
The setup includes:
An inputAccessoryView above keyboard
An input box anchored to the top of the inputAccessoryView using the following constraint:
[self.view.keyboardLayoutGuide.topAnchor constraintEqualToAnchor:self.inputBoxContainerView.bottomAnchor]
Expected Behavior:
Before iOS 26, when keyboard toggled by clicking the input box, the input box should move above the inputAccessoryView.
Actual Behavior:
However, on iOS 26, when switching to a third-party IME (e.g. 百度输入法baidu,搜狗输入法sogou,微信输入法wechat), then click the input box, the input box is above the keyboard instead of the inputAccessoryView, and is covered by the inputAccessoryView.
I am struggling to change the tint of the back button in an UINavigationItem. In iOS 18.6 it looks like this
while on iOS 26 the same looks like this
I can live without the Dictionary but I'd like to get the blue color back.
In viewDidLoad() I have tried
navigationItem.backBarButtonItem?.tintColor = .link
but this did not work since navigationItem.backBarButtonItem is nil. My second attempt was
navigationController?.navigationBar.tintColor = .link
but this didn't work either.
I have even set the Global Tint to Link Color
but this had no effect either.
Does anyone have an idea how to change the tint of the back button in an UINavigationItem on iOS 26?
After reviewing the following Apple Technote, I have confirmed the statement below: https://developer.apple.com/documentation/technotes/tn3187-migrating-to-the-uikit-scene-based-life-cycle
In the next major release following iOS 26, UIScene lifecycle will be required when building with the latest SDK; otherwise, your app won’t launch. While supporting multiple scenes is encouraged, only adoption of scene life-cycle is required.
Based on the above, I would appreciate it if you could confirm the following points:
Is my understanding correct that the term “latest SDK” refers to Xcode 27?
Is it correct that an app built with the latest SDK (Xcode 27, assuming the above understanding is correct) will not launch without adopting the UIScene lifecycle, with no exceptions?
Is it correct that an app built with Xcode 26 without UIScene lifecycle support will still launch without issues on an iPhone updated to iOS 27?
Setup:
I have a segment view with 3 segments, and the last on (at index 2) is disabled.
Issue:
When I drag the liquid glass handle of the segment view from what was previously selected to the disabled segment, the liquid glass handle freezes mid-air.
Workaround:
I can still interact with the handle and manually restore its position, or tap on any other segment to restore its position.
Notes:
I'm using UIKit, and no extra customizations are applied.
class ViewController: UIViewController {
@IBOutlet weak var segmentView: UISegmentedControl!
override func viewDidLoad() {
super.viewDidLoad()
segmentView.removeAllSegments()
let segments = ["Option 1", "Option 2", "Option 3"]
for (index, title) in segments.enumerated() {
segmentView.insertSegment(withTitle: title, at: index, animated: false)
}
// Select the first one by default
segmentView.selectedSegmentIndex = 0
// Disable the last segment
segmentView.setEnabled(false, forSegmentAt: 2)
}
}
Hello!
I'm making a list of app icons for users to choose, but when I increase or decrease the font size, the image is still in the same spot and isn't centered vertically with the text. I have it initialized with a frame with hard-coded values, but I was wondering if there was a better way of doing it, such as with constraints or some sort of image scaling.
I've provided code blocks and an image of what is happening.
ImageView Configuration
// App Icon Image
UIImageView *appIconImageView = [[UIImageView alloc] initWithFrame: CGRectMake(12.5, 17, 22.5, 22.5)];
// Configurations
UIImageSymbolConfiguration *multicolorConfiguration = [UIImageSymbolConfiguration configurationPreferringMulticolor];
UIImageSymbolConfiguration *sizeConfiguration = [UIImageSymbolConfiguration configurationWithScale: UIImageSymbolScaleSmall];
UIImageSymbolConfiguration *appIconConfiguration = [multicolorConfiguration configurationByApplyingConfiguration: sizeConfiguration];
appIconImageView.preferredSymbolConfiguration = appIconConfiguration;
appIconImageView.contentMode = UIViewContentModeScaleAspectFill;
self.appIconImage = appIconImageView;
[appIconImageView release];
ImageView Constraints
[self.appIconImage.firstBaselineAnchor constraintEqualToAnchor: self.contentView.firstBaselineAnchor constant: 5.0],
[self.appIconImage.leadingAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.leadingAnchor],
// Label
[self.colorLabel.leadingAnchor constraintEqualToAnchor:self.appIconImage.trailingAnchor constant: 10],
[self.colorLabel.trailingAnchor constraintEqualToAnchor:self.contentView.layoutMarginsGuide.trailingAnchor],
[self.colorLabel.topAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.topAnchor],
[self.colorLabel.bottomAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.bottomAnchor],
Image
We are seeing a strange lifecycle issue on multiple MDM-managed iPads where
application(_:didFinishLaunchingWithOptions:) is not called after the device is idle overnight.
Even if we terminate the app manually via the app switcher, the next morning the system does not perform a cold launch. Instead, the app resumes directly in:
applicationDidBecomeActive(_:)
This causes all initialization logic that depends on didFinishLaunching to be completely skipped.
This behavior is consistent across four different supervised MDM devices.
Environment
Devices: iPads enrolled in MDM (supervised)
iOS version: 18.3
Xcode: 16.4
macOS: Sequoia 15.7.2
App type: Standard UIKit iOS app
App: Salux Audiometer (App Store app)
Expected Behavior
If the app was terminated manually using the app switcher, the next launch should:
Start a new process
Trigger application(_:didFinishLaunchingWithOptions:)
Follow the normal cold-start lifecycle
Actual Behavior
After leaving the iPad idle overnight (8–12 hours):
The next launch skips didFinishLaunching
The app resumes directly in applicationDidBecomeActive
No new process is started
App behaves as if it had been suspended, even though it was manually terminated
Logs (Relevant Extracts)
Day 1 — Normal cold launch
[12:06:44.152 PM] PROCESS_STARTED
[12:06:44.214 PM] DID_FINISH_LAUNCHING_START launchOptions=[]
[12:06:44.448 PM] DID_FINISH_LAUNCHING_END
We then used the app and terminated it via app switcher.
Day 2 — Unexpected resume without cold start
[12:57:49.328 PM] APP_DID_BECOME_ACTIVE
No PROCESS_STARTED
No didFinishLaunching
No cold-start logs
This means the OS resumed the app from a previous state that should not exist.
Reproducible Steps
Use an MDM-enrolled iPad.
Launch the app normally.
Terminate it manually via the multitasking app switcher.
Leave the device idle overnight (8–12 hours).
Launch the app the next morning.
Observe that:
didFinishLaunching does not fire
applicationDidBecomeActive fires directly
Questions for Apple Engineers / Community
Is this expected behavior on MDM-supervised devices in iOS 18?
Are there any known OS-level changes where terminated apps may be revived from disk/memory?
Could MDM restrictions or background restoration policies override app termination?
How can we ensure that our app always performs a clean initialization when launched after a long idle period?
Additional Information
We have full logs from four separate MDM iPads showing identical behavior.
Happy to share a minimal reproducible sample if required.
I have an application that needs to make a USSD call, but on some devices the * and # don't work on the dialer, on others it does.
if let phoneNumber = ussdNumberTextfield.text {
let encoded = "telprompt:\(phoneNumber)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
if let url = URL(string: encoded) {
if application.canOpenURL(url){
DispatchQueue.main.async {
self.application.open(url, options: [:]) { success in
}
}
}
}
}
Description
I am seeing inconsistent clipping behavior in UICollectionViewCell when presenting a context menu by long press on a subview that uses UIGlassEffect.
Summary of behavior:
Long-pressing a normal view inside a UICollectionViewCell presents the menu correctly (no clipping).
Long-pressing a view wrapped in UIVisualEffectView using UIGlassEffect causes the sub-view with glass effect to be clipped at the cell’s bounds.
clipsToBounds = false is set on:
the cell
the cell’s contentView
This behavior is reproducible and appears to be specifically related to UIGlassEffect.
Description
I'm developing a custom keyboard extension using UIInputViewController and need to set a specific height of 268 points. The keyboard functions correctly, but there's a visible flicker and resize animation during launch that I cannot eliminate.
The Problem
When the keyboard launches, iOS provides incorrect heights before settling on the correct one. At launch, the view starts at 0×0. Around 295ms later, iOS sets the frame to 440×956 which is full screen height and wrong. Around 373ms, iOS changes it to 440×452 which is still wrong. Finally around 390ms, iOS settles at 440×268 which matches our constraint.
This causes visible flicker as the view resizes three times rapidly. The keyboard appears to shrink from full screen down to the correct height, and users can clearly see this animation happening.
What I've Tried
I've tried adding a height constraint on self.view which gives me the correct height but causes the visible flicker.
I created a custom UIInputView subclass and overrode intrinsicContentSize to return my desired height. iOS completely ignores this and gives random heights like 471pt, 680pt, or 956pt instead.
I set allowsSelfSizing to true on my UIInputView subclass. iOS ignores this property.
I set preferredContentSize on the view controller. iOS ignores this as well.
I tried adding the constraint in viewDidAppear instead of viewDidLoad, thinking iOS might have settled by then. It still causes flicker.
I overrode the frame and bounds setters on my UIInputView to clamp the height to my desired value. iOS bypasses these overrides somehow.
I overrode layoutSubviews to force the correct height after the super call. iOS still applies its own height.
Specific Question
What is the correct API or technique to specify a keyboard extension's height that iOS will respect immediately upon launch, without triggering the resize animation sequence?
Other third-party keyboards like Grammarly and SwiftKey appear to have solved this problem. Their keyboards appear at the correct height without any visible flicker. How do they achieve this?
Expected Outcome
The keyboard should appear at 268pt height on the first frame with no visible resize animation.
Steps to Reproduce
Create a new iOS App project in Xcode and add a Keyboard Extension target. In KeyboardViewController.swift, add a height constraint in viewDidLoad:
override func viewDidLoad() {
super.viewDidLoad()
let heightConstraint = view.heightAnchor.constraint(equalToConstant: 268)
heightConstraint.priority = .defaultHigh
heightConstraint.isActive = true
let label = UILabel()
label.text = "Demo Keyboard"
label.textAlignment = .center
label.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(label)
NSLayoutConstraint.activate([
label.centerXAnchor.constraint(equalTo: view.centerXAnchor),
label.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
}
Build and run on a physical device. Enable the keyboard in Settings, then General, then Keyboard, then Keyboards. Open any app with a text field and switch to the custom keyboard using the globe button. Observe the height changing from around 956pt to 452pt to 268pt with visible animation.
Environment
iOS 17 and iOS 18 and 26.2, Xcode 16 and Xcode 26, affects all iPhone models tested, reproducible on both simulator and physical device.
crash stack:
Crashed: com.apple.main-thread
0 libsystem_pthread.dylib 0x90c thread_chkstk_darwin + 60
1 libsystem_pthread.dylib 0x90c ___chkstk_darwin + 60
2 CoreAutoLayout 0x14c4 -[NSISEngine _flushPendingRemovals] + 56
3 CoreAutoLayout 0x2de08 -[NSISEngine _coreReplaceMarker:withMarkerPlusDelta:].cold.1 + 64
4 CoreAutoLayout 0x15d78 -[NSISEngine _coreReplaceMarker:withMarkerPlusDelta:] + 204
5 CoreAutoLayout 0x2ce38 -[NSISEngine constraintDidChangeSuchThatMarker:shouldBeReplacedByMarkerPlusDelta:] + 108
6 CoreAutoLayout 0x15f1c -[NSISEngine tryToChangeConstraintSuchThatMarker:isReplacedByMarkerPlusDelta:undoHandler:] + 100
7 CoreAutoLayout 0x2fdbc -[NSLayoutConstraint _tryToChangeContainerGeometryWithUndoHandler:] + 252
8 CoreAutoLayout 0x3020c -[NSLayoutConstraint _setSymbolicConstant:constant:symbolicConstantMultiplier:] + 452
9 CoreAutoLayout 0x30378 -[NSLayoutConstraint setConstant:] + 84
10 UIKitCore 0x51c3c __74-[UIView(UIConstraintBasedLayout) _autoresizingConstraints_frameDidChange]_block_invoke + 140
11 UIKitCore 0x1841174 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 112
12 UIKitCore 0x51b28 -[UIView(UIConstraintBasedLayout) _autoresizingConstraints_frameDidChange] + 452
13 UIKitCore 0x2c894 -[UIView _constraints_frameDidChange] + 100
14 UIKitCore 0x18fac08 -[UIView(Geometry) setFrame:] + 576
15 UIKitCore 0x96712c -[UITabBar setFrame:] + 128
16 UIKitCore 0x1666f4 -[_UITabBarControllerVisualStyle updateTabBarLayout] + 360
17 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
18 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
19 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
20 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
21 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
22 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
23 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
24 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
25 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
26 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
27 UIKitCore 0x16642c -[UITabBarController _prepareTabBar] + 128
28 UIKitCore 0x166a10 -[UITabBarController _layoutContainerView] + 376
29 UIKitCore 0x1677a8 -[UITabBarController __viewWillLayoutSubviews] + 28
30 UIKitCore 0x147078 -[UILayoutContainerView layoutSubviews] + 176
31 UIKit 0xb14a0 -[UILayoutContainerViewAccessibility layoutSubviews] + 60
for a more detail crash stack, can see attach file:
crash.txt
crash probabilistic happed after app enter background, and our app support landscape, when crash appear, the system method:
/*
This method is called when the view controller's view's size is changed by its parent (i.e. for the root view controller when its window rotates or is resized).
If you override this method, you should either call super to propagate the change to children or manually forward the change to children.
*/
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator API_AVAILABLE(ios(8.0));
is called;
but for a normal not crash case, when enter background and rotate device, the viewWillTransitionToSize method is not called until app enter foreground;
Are there any suggestions that can help solve this problem, thank you.
Environment
macOS 15.7.3
Xcode 26.1.1 / 26.2
iOS 18.5 / 26.2
iPhone 16 Pro Simulator and physical device
Problem Description
When tapping an unselected UISegmentedControl, the selected segment does not match the tapped position. Specifically, tapping the rightmost segment (index: 3) results in the leftmost segment (index: 0) being selected instead.
Conditions for Reproduction
This issue occurs when all of the following conditions are met:
Built with Xcode 26.x
UIDesignRequiresCompatibility is set to YES in Info.plist
UISegmentedControl is positioned using Auto Layout with leading alignment
Segments are added dynamically using insertSegment(withTitle:at:animated:)
Note: The issue does not occur when segments are defined statically in Storyboard.
Steps to Reproduce
Create a subclass of UISegmentedControl that dynamically sets segments:
class CustomSegmentedControl: UISegmentedControl {
func setSegments(titles: [String]) {
removeAllSegments()
titles.forEach { title in
insertSegment(withTitle: title, at: numberOfSegments, animated: false)
}
}
}
In the ViewController, configure the control:
override func viewDidLoad() {
super.viewDidLoad()
segmentedControl.setSegments(titles: ["Item A", "Item B", "Item C", "Item D"])
segmentedControl.selectedSegmentIndex = UISegmentedControl.noSegment
}
Set UIDesignRequiresCompatibility to YES in Info.plist:
<key>UIDesignRequiresCompatibility</key>
<true/>
Run the app and tap the rightmost segment ("Item D")
Expected vs Actual Behavior
Expected
Actual
Tap rightmost segment
"Item D" (index: 3) is selected
"Item A" (index: 0) is selected
What I Tried (Did Not Work)
Calling layoutIfNeeded() after adding segments:
segmentedControl.setSegments(titles: ["Item A", "Item B", "Item C", "Item D"])
segmentedControl.layoutIfNeeded() // No effect
Workarounds
Set UIDesignRequiresCompatibility to NO (enables Liquid Glass design)
Define segments statically in Storyboard instead of dynamically
Sample Project
Minimal reproduction project is available here:
https://github.com/CH3COOH/Samples/tree/master/SampleSelectSegmentedControl
Feedback Assistant
This issue has been reported via Feedback Assistant: FB21712773
Has anyone else encountered this issue or found alternative workarounds?
The default app menu on iPadOS 26 includes an Edit menu with items (among others) Cut, Copy, Paste, Paste and Match Style. I want to remove the last one.
I tried the following but nothing worked:
let configuration = UIMainMenuSystem.Configuration()
configuration.textFormattingPreference = .removed
UIMainMenuSystem.shared.setBuildConfiguration(configuration) { builder in
builder.remove(action: .pasteAndMatchStyle)
if let command = builder.menu(for: .edit)?.children.first(where: { ($0 as? UICommand)?.action == #selector(UIResponderStandardEditActions.pasteAndMatchStyle(_:)) }) as? UICommand {
command.attributes.insert(.hidden)
}
}
Hi,
I am implementing a sidebar navigation using UITabBarController with the new UITabGroup API on and above iPadOS 18. I’ve encountered an issue where selecting a child UITab within a group does not seem to trigger the child's own viewControllerProvider. Instead, the UITabBarController displays the ViewController associated with the parent UITabGroup.
The Issue: In the snippet below, when I tap "Item 2A" or "Item 2B" in the iPad sidebar, the app displays the emptyVC (clear background) defined in the section2Group provider, rather than the teal or cyan ViewControllers defined in the individual child tabs.
let item2A = UITab(
title: "Item 2A",
image: UIImage(systemName: "a.circle"),
identifier: "tab.section2.item2a"
) { _ in
self.createViewController(
title: "Section 2 - Item 2A",
color: .systemTeal,
description: "Part of Section 2A group"
)
}
let item2B = UITab(
title: "Item 2B",
image: UIImage(systemName: "b.circle"),
identifier: "tab.section2.item2b"
) { _ in
self.createViewController(
title: "Section 2 - Item 2B",
color: .systemCyan,
description: "Part of Section 2B group"
)
}
item2A.preferredPlacement = .sidebarOnly
item2B.preferredPlacement = .sidebarOnly
let section2Group = UITabGroup(
title: "Section 2",
image: UIImage(systemName: "folder.fill"),
identifier: "tabgroup.section2",
children: [item2A, item2B]
) { _ in
// This provider seems to take precedence over children
let emptyVC = UIViewController()
emptyVC.view.backgroundColor = .clear
return emptyVC
}
section2Group.preferredPlacement = .sidebarOnly
tabs.append(section2Group)
The Crash: If I attempt to resolve this by removing the viewControllerProvider from the UITabGroup (with the intent that only children should provide views), the application crashes at runtime. The exception indicates that all tabs within the sidebar must have an associated ViewController, suggesting that the UITabGroup requires a provider even if it is intended to act purely as a visual container.
Kindly clarify the following:
Is it the intended behavior for UITabGroup to override the viewControllerProvider of its children during sidebar selection?
Why does the API require the UITabGroup to return a ViewController if the selection target is a child UITab?
Is there a specific configuration or delegate method required to allow the UITabBarController to "pass through" the selection to the child tab's provider?
I would appreciate any guidance on whether this is an API limitation or if there is a different structural approach recommended for grouped sidebar items.
Hi,
How to enable multitouch on ARView?
Touch functions (touchesBegan, touchesMoved, ...) seem to only handle one touch at a time. In order to handle multiple touches at a time with ARView, I have to either:
Use SwiftUI .simultaneousGesture on top of an ARView representable
Position a UIView on top of ARView to capture touches and do hit testing by passing a reference to ARView
Expected behavior:
ARView should capture all touches via touchesBegan/Moved/Ended/Cancelled.
Here is what I tried, on iOS 26.1 and macOS 26.1:
ARView Multitouch
The setup below is a minimal ARView presented by SwiftUI, with touch events handled inside ARView. Multitouch doesn't work with this setup.
Note that multitouch wouldn't work either if the ARView is presented with a UIViewController instead of SwiftUI.
import RealityKit
import SwiftUI
struct ARViewMultiTouchView: View {
var body: some View {
ZStack {
ARViewMultiTouchRepresentable()
.ignoresSafeArea()
}
}
}
#Preview {
ARViewMultiTouchView()
}
// MARK: Representable ARView
struct ARViewMultiTouchRepresentable: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
let arView = ARViewMultiTouch(frame: .zero)
let anchor = AnchorEntity()
arView.scene.addAnchor(anchor)
let boxWidth: Float = 0.4
let boxMaterial = SimpleMaterial(color: .red, isMetallic: false)
let box = ModelEntity(mesh: .generateBox(size: boxWidth), materials: [boxMaterial])
box.name = "Box"
box.components.set(CollisionComponent(shapes: [.generateBox(width: boxWidth, height: boxWidth, depth: boxWidth)]))
anchor.addChild(box)
return arView
}
func updateUIView(_ uiView: ARView, context: Context) { }
}
// MARK: ARView
class ARViewMultiTouch: ARView {
required init(frame: CGRect) {
super.init(frame: frame)
/// Enable multi-touch
isMultipleTouchEnabled = true
cameraMode = .nonAR
automaticallyConfigureSession = false
environment.background = .color(.gray)
/// Disable gesture recognizers to not conflict with touch events
/// But it doesn't fix the issue
gestureRecognizers?.forEach { $0.isEnabled = false }
}
required dynamic init?(coder decoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches {
/// # Problem
/// This should print for every new touch, up to 5 simultaneously on an iPhone (multi-touch)
/// But it only fires for one touch at a time (single-touch)
print("Touch began at: \(touch.location(in: self))")
}
}
}
Multitouch with an Overlay
This setup works, but it doesn't seem right. There must be a solution to make ARView handle multi touch directly, right?
import SwiftUI
import RealityKit
struct MultiTouchOverlayView: View {
var body: some View {
ZStack {
MultiTouchOverlayRepresentable()
.ignoresSafeArea()
Text("Multi touch with overlay view")
.font(.system(size: 24, weight: .medium))
.foregroundStyle(.white)
.offset(CGSize(width: 0, height: -150))
}
}
}
#Preview {
MultiTouchOverlayView()
}
// MARK: Representable Container
struct MultiTouchOverlayRepresentable: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
/// The view that SwiftUI will present
let container = UIView()
/// ARView
let arView = ARView(frame: container.bounds)
arView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
arView.cameraMode = .nonAR
arView.automaticallyConfigureSession = false
arView.environment.background = .color(.gray)
let anchor = AnchorEntity()
arView.scene.addAnchor(anchor)
let boxWidth: Float = 0.4
let boxMaterial = SimpleMaterial(color: .red, isMetallic: false)
let box = ModelEntity(mesh: .generateBox(size: boxWidth), materials: [boxMaterial])
box.name = "Box"
box.components.set(CollisionComponent(shapes: [.generateBox(width: boxWidth, height: boxWidth, depth: boxWidth)]))
anchor.addChild(box)
/// The view that will capture touches
let touchOverlay = TouchOverlayView(frame: container.bounds)
touchOverlay.autoresizingMask = [.flexibleWidth, .flexibleHeight]
touchOverlay.backgroundColor = .clear
/// Pass an arView reference to the overlay for hit testing
touchOverlay.arView = arView
/// Add views to the container.
/// ARView goes in first, at the bottom.
container.addSubview(arView)
/// TouchOverlay goes in last, on top.
container.addSubview(touchOverlay)
return container
}
func updateUIView(_ uiView: UIView, context: Context) {
}
}
// MARK: Touch Overlay View
/// A UIView to handle multi-touch on top of ARView
class TouchOverlayView: UIView {
weak var arView: ARView?
override init(frame: CGRect) {
super.init(frame: frame)
isMultipleTouchEnabled = true
isUserInteractionEnabled = true
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let totalTouches = event?.allTouches?.count ?? touches.count
print("--- Touches Began --- (New: \(touches.count), Total: \(totalTouches))")
for touch in touches {
let location = touch.location(in: self)
/// Hit testing.
/// ARView and Touch View must be of the same size
if let arView = arView {
let entity = arView.entity(at: location)
if let entity = entity {
print("Touched entity: \(entity.name)")
} else {
print("Touched: none")
}
}
}
}
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
let totalTouches = event?.allTouches?.count ?? touches.count
print("--- Touches Cancelled --- (Cancelled: \(touches.count), Total: \(totalTouches))")
}
}