When a subclass of UIInputView is created programmatically, a memory leak occurs.
This issue can be easily reproduced even with a very simple sample project, so I’m submitting this report along with a minimal reproducible example.
When a custom view subclassing UIInputView is instantiated in code,
_InputViewContent retains the custom view, and the custom view also holds a reference back to _InputViewContent,
creating a strong reference cycle that prevents deallocation.
The issue consistently occurs and has been confirmed on Xcode 16.4, 26.0, and 26.1.
As a workaround, initializing the view via Storyboard allows it to be properly deallocated from memory.
(Please refer to the CustomInputView in the attached sample code.)
import UIKit
final class LeakInputView: UIInputView {
deinit {
print("LeakInputView deinit") // not called
}
}
final class CustomInputView: UIInputView {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(frame: CGRect, inputViewStyle: UIInputView.Style) {
super.init(frame: frame, inputViewStyle: inputViewStyle)
}
deinit {
print("CustomInputView deinit") // called
}
}
extension CustomInputView {
static func loadFromNib() -> CustomInputView {
let nib = UINib(nibName: "CustomInputView", bundle: nil)
guard let view = nib.instantiate(withOwner: nil, options: nil).first as? CustomInputView else {
fatalError("Failed to load CustomInputView from nib.")
}
return view
}
}
final class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
LeakInputView()
LeakInputView()
LeakInputView()
CustomInputView.loadFromNib()
CustomInputView.loadFromNib()
CustomInputView.loadFromNib()
DispatchQueue.main.async {
print("Next runloop tick")
}
}
}
UIKit
RSS for tagConstruct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I use the following bit of code to snapshot a View as a UIImage, but it's causing a memory leak:
extension View {
@ViewBuilder func snapshot(trigger: Bool, onComplete: @escaping (UIImage) -> ()) -> some View {
self.modifier(SnapshotModifier(trigger: trigger, onComplete: onComplete))
}
}
fileprivate struct SnapshotModifier: ViewModifier {
var trigger: Bool
var onComplete: (UIImage) -> ()
@State private var view: UIView = .init(frame: .zero)
func body(content: Content) -> some View {
content
.background(ViewExtractor(view: view))
.compositingGroup()
.onChange(of: trigger) {
generateSnapshot()
}
}
private func generateSnapshot() {
if let superView = view.superview?.superview {
let render = UIGraphicsImageRenderer(size: superView.bounds.size)
let image = render.image { _ in
superView.drawHierarchy(in: superView.bounds, afterScreenUpdates: true)
}
onComplete(image)
}
}
}
fileprivate struct ViewExtractor: UIViewRepresentable {
var view: UIView
func makeUIView(context: Context) -> UIView {
view.backgroundColor = .clear
return view
}
func updateUIView(_ uiView: UIView, context: Context) {
// No process
}
}
Taking the snapshot is triggered like this:
struct ContentView: View {
@State private var triggerSnapshot: Bool = false
var body: some View {
Button("Press to snapshot") {
triggerSnapshot = true
}
TheViewIWantToSnapshot()
.snapshot(trigger: triggerSnapshot) { image in
// Save the image; you don't have to do anything here to get the leak.
}
}
}
I'm not the best at Instruments, and this is what the Leaks template produces. There are no method names, just memory addresses:
Is this leak in an internal iOS library, is there something wrong with Instruments, or am I missing something obvious in my code?
Thanks.
The application crashes immediately when the system attempts to display the automatic password input view controller (_SFAutomaticPasswordInputViewController). This occurs during the login or password-filling process.
OS Version: iOS 26.2 Beta 1
Build Number: (23C5027f)
Fatal Exception: NSInvalidArgumentException
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
Hi,
I am running iOS Simulator on iOS 26 and I am trying to change unselectedItemTintColor of UITabBarItem in my TabBarViewController but it did not work when I tried following ways:
Setting an iconColor through UITabBarAppearance() class
Setting unselected item tint color like tabBar.unselectedItemTintColor = .black
As an example attached file, I would like to set Settings tab's item color (icon + title) with different one when it is unselected.
Hello Apple Team,
I’ve encountered a regression in iOS 26.1 when building my app with Xcode 26 (iOS 26 SDK).
The issue affects PKPaymentButtonType.plain, which now renders as fully invisible and produces transparent snapshots, even though the same code worked correctly in previous Xcode/iOS versions.
This has a real-world impact because many apps generate static images from PKPaymentButton for payment selection UIs using UIGraphicsImageRenderer, layer.render(in:), or custom snapshot utilities.
When using
PKPaymentButton(paymentButtonType: .plain, paymentButtonStyle: .black)
on iOS 26.1, when built with Xcode 26, the button:
Appears blank / invisible
Cannot be snapshotted
Produces a fully transparent UIImage, even though the CGImage object exists
Behaves differently than older SDKs (Xcode 16.x / iOS < 26.1
This regression only appears when compiling with the new SDK.
Other button types work fine.
Expected Behavior
.plain button should render glyphs as documented
snapshot generated via UIGraphicsImageRenderer or drawHierarchy(in:) should produce a visible image
Behavior should be consistent with older SDKs unless explicitly deprecated in release notes
Expected Behavior
.plain button should render glyphs as documented
Snapshot generated via UIGraphicsImageRenderer or drawHierarchy(in:) should produce a visible image
Behavior should be consistent with older SDKs unless explicitly deprecated in release notes
Actual Behavior
.plain button renders no glyph at all
Snapshot image is fully transparent (alpha = 0), even though size and CGImage metadata are correct
Only happens when built with Xcode 26 SDK
Same build from Xcode 16.x does not reproduce the issue
Steps to Reproduce
Create a minimal sample project in Xcode 26
Add the following code:
let button = PKPaymentButton(paymentButtonType: .plain, paymentButtonStyle: .black)
button.frame = CGRect(x: 0, y: 0, width: 180, height: 48)
let renderer = UIGraphicsImageRenderer(size: button.bounds.size)
let image = renderer.image { _ in
button.drawHierarchy(in: button.bounds, afterScreenUpdates: true)
}
print(image)
Run on iOS 26.1 device or simulator
Observe that:
The button appears visually empty
The generated image is fully transparent
Environment
Xcode: 26.x (iOS 26 SDK)
iOS: 26.1 (iPhone 15 Pro tested)
Device: Real device
Framework: UIKit + PassKit
Button type: .plain ONLY
Other types: .pay/.buy/.checkout = OK
I see in iPhone built-in apps that action sheets are presented as popovers without arrows over their originating views.
Here is an example in Messages and Shortcuts apps.
In WWDC 2025 session "Build a UIKit app with the new design", the speaker explains that all you have to do is to configurate the popover like we do for iPad.
Here is the relevant transcript:
14:33
ActionSheets on iPad are anchored to their source views. Starting in iOS 26, they behave the same on iPhone, appearing directly over the originating view.
14:46
On the alertController, make sure to set the sourceItem or the sourceView on popoverPresentationController, regardless of which device it’s displayed on. Assigning the source view automatically applies the new transitions to action sheets as well! Action sheets presented inline don’t have a cancel button because the cancel action is implicit by tapping anywhere else. If you don’t specify a source, the action sheet will be centered, and you will have a cancel button. iOS 26 provides a new, more integrated search experience, letting you position the search field where it best suits the needs of your app.
I do this in this sample code:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
let actionButton = UIButton(configuration: .bordered())
actionButton.setTitle("Show Action Sheet", for: .normal)
actionButton.addTarget(self, action: #selector(showActionSheet), for: .touchUpInside)
actionButton.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(actionButton)
NSLayoutConstraint.activate([
actionButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
actionButton.centerYAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor, constant: 100)
])
}
@objc private func showActionSheet(_ button: UIButton) {
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Option 1", style: .default, handler: { _ in
print("Option 1 selected")
}))
alert.addAction(UIAlertAction(title: "Option 2", style: .default, handler: { _ in
print("Option 2 selected")
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
// Set the popover presentation anchor
if let popover = alert.popoverPresentationController {
popover.sourceItem = button
}
present(alert, animated: true, completion: nil)
}
}
When I run this code in iOS 26, I get a popover (versus a bottom action sheet on iOS 18) but this popover has an arrow.
What do I miss to display this popover like Apple does on iOS 26: without an arrow and over the originating view?
Topic:
UI Frameworks
SubTopic:
UIKit
My project uses the UINavigationController's largeTitle on the latest iOS 26.1, but I found that when I set the backgroundColor, the navigation bar's largeTitle disappeared after switching between normal and large titles. I checked the latest documentation and consulted AI, but I have not found any good solutions. For the demo project, please refer to FB20986869
I have a UICollectionView using a UICollectionViewCompositionalLayout with an orthogonally scrolling section. When selecting a cell, I present a modal view controller with a zoom transition.
If I scroll quickly in that section after dismissing the presented view controller, the cells briefly overlap. See the attached screenshot.
This issue occurs only on iOS 26 and does not occur on iOS 18.
Has anyone found a way to mitigate this?
Sample project: https://github.com/antiraum/iOS26_UICollectionViewZoomTransitionIssue
Feedback FB21022192
I have a UIViewController that uses MKMapview to display the motion history trajectory. Repeatedly entering and exiting UIViewController will cause a crash, and the crash stack is as follows:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000014bfc0fc8
Exception Codes: 0x0000000000000001, 0x000000014bfc0fc8
VM Region Info: 0x14bfc0fc8 is not in any region. Bytes after previous region: 217033 Bytes before following region: 61496
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
VM_ALLOCATE 14bf88000-14bf8c000 [ 16K] rw-/rwx SM=PRV
---> GAP OF 0x44000 BYTES
VM_ALLOCATE 14bfd0000-14bfd4000 [ 16K] rw-/rwx SM=PRV
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [1881]
Triggered by Thread: 8
Thread 8 name: Dispatch queue: com.apple.root.background-qos
Thread 8 Crashed:
0 CoreFoundation 0x19e36ac40 CFRelease + 44
1 VectorKit 0x1ce16af6c md::TileGroupNotificationManager::~TileGroupNotificationManager() + 132
2 VectorKit 0x1cd6f7178 <deduplicated_symbol> + 76
3 VectorKit 0x1cdba8d74 -[VKSharedResources .cxx_destruct] + 32
4 libobjc.A.dylib 0x19b3321f8 object_cxxDestructFromClass(objc_object*, objc_class*) + 116
5 libobjc.A.dylib 0x19b32df20 objc_destructInstance_nonnull_realized(objc_object*) + 76
6 libobjc.A.dylib 0x19b32d4a4 _objc_rootDealloc + 72
7 VectorKit 0x1cdba93fc -[VKSharedResources dealloc] + 476
8 VectorKit 0x1cdafa3fc -[VKSharedResourcesManager _removeResourceUser] + 68
9 VectorKit 0x1cdafa380 +[VKSharedResourcesManager removeResourceUser] + 44
10 VectorKit 0x1cdafa2fc __37-[VKIconManager _internalIconManager]_block_invoke + 168
11 libdispatch.dylib 0x1d645b7ec _dispatch_client_callout + 16
12 libdispatch.dylib 0x1d6446664 _dispatch_continuation_pop + 596
13 libdispatch.dylib 0x1d6459528 _dispatch_source_latch_and_call + 396
14 libdispatch.dylib 0x1d64581fc _dispatch_source_invoke + 844
15 libdispatch.dylib 0x1d6453f48 _dispatch_root_queue_drain + 364
16 libdispatch.dylib 0x1d64546fc _dispatch_worker_thread2 + 180
17 libsystem_pthread.dylib 0x1f9b7e37c _pthread_wqthread + 232
18 libsystem_pthread.dylib 0x1f9b7d8c0 start_wqthread + 8
I have checked the code and did not find any issues. I have also tested on iOS 15, 16, and 18 without any issues. Could this be an error in the iOS 26 system? Have you ever met any friends? I hope to receive an answer. Thank you.
The PaperMarkup class in PaperKit allows for an asynchronous function called .draw(in:, frame:) that we should call as:
await paperMarkup.draw(in: context.cgContext, frame: rect)
In PencilKit the PKDrawing that we can get from a PKCanvasView allows for .image(from: ,scale:) to be called synchronously.
This allows me to easily render into a PKDrawing as a UIImage or a SwiftUI Image to, for example, render a thumbnail on screen.
When trying to incorporate PaperKit in my project I noticed that I often need the drawing to be rendered synchronously (like I would with PKDrawing) but I can't find the way to accomplish this within PaperKit's current functionality.
Is there any way to call .draw(...) in PaperKit synchronously?
Feedback: FB20993683
Using the ContactUI framework CNContactViewController(forNewContact contact: CNContact?) to add a new contact to the ContactStore.
If the new contact does not have an attached image then the contact is saved correctly.
If the new contact DOES have an attached image then all entries in the phoneNumbers or emailAddresses array are doubled when written to the contactStore.
Viewing the contact via the Contacts app shows the duplications.
This is only happening on iOS26+. Earlier versions of the operating system do not show duplicates.
Has anyone else seen this issue?
Feedback reference: FB20910502
I'm using one UITabBarController which leads to 6 NavigationController. Therefore the user will get 4 icons displayed and one icon with three points to see the rest of the Navigation Controller.
If the user now tries to edit the list and moves one item from the hidden area towards the TabBar at the bottom, the App crashes with the error:
Exception
NSException * "Can't add self as subview" 0x0000600000d16040
I can see this effect at least on both my apps.
If the same compilation is run on a older iOS version, there is no crash.
Is there anything I have to take care of the configuration of the TabBar, when it comes to iOS26?
Topic:
UI Frameworks
SubTopic:
UIKit
We're observing several UI issues with VNDocumentCameraViewController on devices running iOS 26. These screens were functioning correctly in earlier iOS versions.
Issue 1 - On the edge correction screen, the top bar now appears as a gray strip beneath the status bar, whereas in previous iOS versions, it was positioned at the bottom of the screen. Do we have any workarounds to address this issue?
Issue2 - The edit buttons and their labels are not clearly visible, affecting usability.
Im using XCode 16.4 to build to iOS26 and the usage is like below:
`let scanner = VNDocumentCameraViewController()
scanner.delegate = self
self.present(scanner, animated: true)`
We're observing several localization issues with VNDocumentCameraViewController on devices running iOS 26. These localizations were correct in earlier iOS versions.
Images indicate that some English labels appear when the device's language is changed to German.
The issue can be reproduced by using the Note app.
I want to scale the Image.
If my Image (or GIF) is 11x33 (width=3 and height=11)
but I want the Image size be 220x660 and how to auto expand the pixel?
the pixel (0,0) in my image will be a 20x20 with same color.
which means the Image(which I want) will has a pixel(0,0) to (20,20) is the same color to the (0,0)
I am having an issue with the code that I posted below. I capture voice in my CarPlay app, then allow the user to have it read back to them using AVSpeechUtterance.
This works fine on some cars, but many of my beta testers report no audio being played. I have also experienced this in a rental car where the audio was either too quiet or the audio didn't play.
Does anyone see any issue with the code that I posted? This is for CarPlay specifically.
class CarPlayTextToSpeechService: NSObject, ObservableObject, AVSpeechSynthesizerDelegate {
private var speechSynthesizer = AVSpeechSynthesizer()
static let shared = CarPlayTextToSpeechService()
/// Completion callback
private var completionCallback: (() -> Void)?
override init() {
super.init()
speechSynthesizer.delegate = self
}
func configureAudioSession() {
do {
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .voicePrompt, options: [.duckOthers, .interruptSpokenAudioAndMixWithOthers, .allowBluetoothHFP])
} catch {
print("Failed to set audio session category: \(error.localizedDescription)")
}
}
public func speak(_ text: String, completion: (() -> Void)? = nil) {
self.configureAudioSession()
// Store the completion callback
self.completionCallback = completion
Task(priority: .high) {
let speechUtterance = AVSpeechUtterance(string: text)
let langCode = Locale.preferredLocalLanguageCountryCode
if langCode == "en-US" {
speechUtterance.voice = AVSpeechSynthesisVoice(identifier: AVSpeechSynthesisVoiceIdentifierAlex)
} else {
speechUtterance.voice = AVSpeechSynthesisVoice(language: langCode)
}
try AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation)
speechSynthesizer.speak(speechUtterance)
}
}
func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didFinish utterance: AVSpeechUtterance) {
Task {
stopSpeech()
try AVAudioSession.sharedInstance().setActive(false)
}
// Call completion callback if available
self.completionCallback?()
self.completionCallback = nil
}
func stopSpeech() {
speechSynthesizer.stopSpeaking(at: .immediate)
}
}
Since iPadOS 26.1 I notice a new annoying bug when changing the dark mode option of the system. The appearance of the UI changes, but no longer for view controllers which are presented as Popover. For these view controllers the method "traitCollectionDidChange()" is still called (though sometimes with a very large delay), but checking the traitCollection property of the view controller in there does no longer return the correct appearance (which is probably why the visual appearance of the popover doesn't change anymore). So if the dark mode was just switched on, traitCollectionDidChange() is called, but the "traitCollection.userInterfaceStyle" property still tells me that the system is in normal mode.
More concrete, traitCollection.userInterfaceStyle seems to be set correctly only(!) when opening the popover, and while the popover is open, it is never updated anymore when the dark mode changes.
This is also visible in the standard Apps of the iPad, like the Apple Maps App: just tap on the "map" icon at the top right to open the "Map mode" view. While the view is open, change the dark mode. All of the Maps App will change its appearance, with the exception of this "Map mode" view.
Does anyone know an easy workaround? Or do I really need to manually change the colors for all popup view controllers whenever the dark mode changes? Using dynamic UIColors won't help, because these rely on the "userInterfaceStyle" property, and this is no longer correct.
Bugreport: FB20928471
Description:
I’m encountering an issue where the Apple Watch’s watchOS version is lower than the deployment target specified in my Xcode project.
For example, my Watch device is running watchOS 10.6, but my app’s deployment target is set to watchOS 9.6 or 10.6, and Xcode shows an error stating:
Error: “watchOS version doesn’t match the app’s deployment target.”
Could someone clarify how to properly handle this version mismatch?
Environment:
Xcode 26
iPhone: iOS 18
Apple Watch: watchOS 10.6
Any guidance or best practices would be appreciated.
I have following code and made it invoke every time when a UIViewController presents another UIViewController through method swizzling. When I try to access the Password management app while input password, these code will be invoked and the presenting VC is instance of UITrackingElementWindowController. It will crash
[presentingVC beginAppearanceTransition:NO animated:NO];
[presentingVC endAppearanceTransition];
With iOS 26.1 and beta 26.2, there is a crash seen for _UIButtonBarItemLayout update. Has anyone experienced this crash or has any information on this
Thread 0 name:
Thread 0 Crashed:
0 libobjc.A.dylib 0x000000019daa144c objc_retain + 16
1 UIKitCore 0x00000001a680b184 -[_UIButtonBarItemLayout _updateItemView] + 360
2 UIKitCore 0x00000001a6d5ddcc -[_UIButtonBarItemLayout minimumLayoutWidthGivenMinimumSpaceWidth:] + 28
3 UIKitCore 0x00000001a6d5eeec -[_UIButtonBarItemGroupLayout recalculateLayoutWidthsGivenItemSpaceWidth:] + 304
4 UIKitCore 0x00000001a6d4ca28 -[_UIButtonBar _widthInfoForLayout:] + 188
5 UIKitCore 0x00000001a68093b4 -[_UIButtonBar _layoutBar] + 108
6 UIKitCore 0x00000001a6809328 __42-[_UIButtonBarStackView updateConstraints]_block_invoke + 44
7 UIKitCore 0x00000001a7dbea8c +[UIView(Animation) performWithoutAnimation:] + 76
8 UIKitCore 0x00000001a68092d0 -[_UIButtonBarStackView updateConstraints] + 112
9 UIKitCore 0x00000001a64707e8 -[UIView(AdditionalLayoutSupport) _previousFittingSizeInfo] + 784
10 UIKitCore 0x00000001a6470508 -[UIView(AdditionalLayoutSupport) _previousFittingSizeInfo] + 48
Topic:
UI Frameworks
SubTopic:
UIKit