Construct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.

UIKit Documentation

Post

Replies

Boosts

Views

Activity

Not possible to remove variable: 221: <unknown var (bug!) with engine as delegate:0x301a75580>{id: 12318} colIndex:60 from engine <NSISEngine: 0x151bc3100>{ delegate:0x151bc2bc0
On the iOS 18 system, we have found that some pages will definitely experience this kind of crash phenomenon when displayed. It's puzzling that I can modify different codes and this kind of crash won't occur on the 18 system. This has had a great impact on my code development, and I don't know if I can still use this API in the future. Can you help me solve this dilemma. thank
1
0
234
Dec ’24
Fatal Exception: NSInternalInconsistencyException Attempting to select a view controller that isn't a child! (null)
When call: [UITabBarController setViewControllers:animated:] It crashed and raise an Fatal Exception: Fatal Exception: NSInternalInconsistencyException Attempting to select a view controller that isn't a child! (null) the crash stack is: Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x8408c __exceptionPreprocess 1 libobjc.A.dylib 0x172e4 objc_exception_throw 2 Foundation 0x82215c _userInfoForFileAndLine 3 UIKitCore 0x38a468 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] 4 UIKitCore 0x3fa8a4 -[UITabBarController _setSelectedViewController:performUpdates:] 5 UIKitCore 0x3fa710 -[UITabBarController setSelectedIndex:] 6 UIKitCore 0x8a5fc +[UIView(Animation) performWithoutAnimation:] 7 UIKitCore 0x3e54e0 -[UITabBarController _setViewControllers:animated:] 8 UIKitCore 0x45d7a0 -[UITabBarController setViewControllers:animated:] And it appear sometimes, what's the root cause?
2
0
467
Nov ’24
activateSceneSession (or requestSceneSessionActivation) always creates new Scene
I'm trying to implement a Help Window from Help Menu in macOS (Mac Catalyst). I have SceneConfiguration in Info.plist and multi-window enabled. Tapping Help menu opens a new Help Window on macOS. I thought it was working great! Unfortunately, tapping Help menu again opens a new Help Window. I only want one Help window to be shown. I expected UIApplication.shared.activateSceneSession(for: request) to use an existing UIScene if one was already present. In my experience I always get a new Scene and thus a new Window. What am I missing? AppDelegate.swift func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // It's important that each UISceneConfiguration have a unique configuration name. var configurationName: String! switch options.userActivities.first?.activityType { case UserActivity.HelpMenuActivityType: configurationName = SceneConfiguration.helpWindowConfiguration default: configurationName = SceneConfiguration.defaultConfiguration } return UISceneConfiguration(name: configurationName, sessionRole: connectingSceneSession.role) } override func buildMenu(with builder: UIMenuBuilder) { super.buildMenu(with: builder) ... builder.remove(menu: .help) builder.insertSibling(helpMenu(), afterMenu: .window) } func helpMenu() -> UIMenu { let children: [UIAction] = [ UIAction(... ) { [weak self] action in self?.helpMenuTappedHandler(action) } ] .... } func helpMenuTappedHandler(_ action: UIAction) { let userActivity: NSUserActivity = ... userActivity.targetContentIdentifier = ... let options: UIScene.ActivationRequestOptions = .init() options.requestingScene = ... let request: UISceneSessionActivationRequest = .init(role: .windowApplication, userActivity: userActivity, options: options) UIApplication.shared.activateSceneSession(for: request, errorHandler: handleHelpError) }
2
0
319
Dec ’24
iOS 18.1 Storyboard doesn't contain a view controller with identifier
Hi All I faced up with strange issue in my app. Everything works in iOS 18.0 and lower. But after install iOS 18.1 same app from App Store crashes every time with error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x11f6287a0>) doesn't contain a view controller with identifier 'MKCPinEntryViewControllerIdentifier'' Interesting that this view controller exist in the Storyboard. First call in app: dispatch_async(dispatch_get_main_queue(), ^{ //No authentication, needs login view controller popped. UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; PinEntryViewController *pinViewController = [storyboard instantiateViewControllerWithIdentifier:@"PinEntryViewControllerIdentifier"]; pinViewController.delegate = self; pinViewController.entryType = PinEntryTypeEnter; [self.presentationContext presentViewController:pinViewController animated:YES completion:nil]; }); works good. But second call in other place after 5 seconds: dispatch_async(dispatch_get_main_queue(), ^{ UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; PinEntryViewController *pinViewController = [storyboard instantiateViewControllerWithIdentifier:@"PinEntryViewControllerIdentifier"]; pinViewController.delegate = self; [self.presentationContext presentViewController:pinViewController animated:YES completion:nil]; }); crash the app with Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x11f6287a0>) doesn't contain a view controller with identifier 'MKCPinEntryViewControllerIdentifier'' *** First throw call stack: (0x1841b47cc 0x1814872e4 0x186d9c140 0x1063d692c 0x10301ec08 0x104370a30 0x10437271c 0x104382de8 0x1043829a4 0x184188204 0x184185440 0x184184830 0x1d01641c4 0x186ceaeb0 0x186d995b4 0x10667fe3c 0x1a9b72ec8) libc++abi: terminating due to uncaught exception of type NSException And issue not only with this view controller. issue with all in that storyboard. At start up instantiateViewControllerWithIdentifier works good with all view controllers identifiers. But on second call in other places in the app - all crash with same error Reproduce in real device with iOS18.1 only. Simulators and devices with iOS 18.0 works well. Could someone help me, what's wrong with the app?
8
5
926
Oct ’24
UIApplication.shared.open(url) is not working on iOS 18+ devices
Im working on a mobile application(Flutter) of an insurance. In the application we have an option to open an external app from our application, we are using external_url as a dependency of flutter, and in the AppDelegate we have the UIApplication.shared.open(url), that was working fine on IOS 17 until we installed the new iOS version(18)eather to open the external app if its already installed in the device or to navigate to App store. We added ":options" and "completionHandler:" to open(url) but nothing works. I can see that its a common issue in the developer forum since iOS 18+. The big problem is the log doesnt show anything.
2
0
295
Dec ’24
Hide header animated from UICollectionViewCompositionalLayout
Hello! I have a collectionView and assigned a layout to it: collectionView.collectionViewLayout = createLayout(hasHeader: true) func createLayout(hasHeader: Bool) -> UICollectionViewCompositionalLayout { let layout = UICollectionViewCompositionalLayout { [weak self] (section,environment) -> NSCollectionLayoutSection? in // configure cells } // adding a header: if hasHeader { let header = //... layout.boundarySupplementaryItems.append(header) } return layout } Now, I just want to hide the header (animated). Removing the header can simply be done this way, but this is not animated: collectionView.collectionViewLayout = createLayout(hasHeader: false) Is there any other possibility to hide it animated?
1
0
208
Dec ’24
UIWritingToolsCoordinator.Context Lifetime?
What is the lifetime of a UIWritingToolsCoordinator.Context object? The UIWritingToolsCoordinator.Delegate API expects you to maintain a reference to the context identifiers you create in writingToolsCoordinator(:contextsFor:) to be able to return them in writingToolsCoordinator(:rangeInContextWithIdentifierFor:). At some point, you need to release these references. Can you, for example, assume that the context will not be referenced after writingToolsCoordinator(_:willChangeToState:) is called with a state of .inactive?
0
1
208
Dec ’24
TextKit2 : - The text inserted between the attributedText(Paragraph) doesn't inherit the attributes of existing text
I have added an custom attribute for a paragraph using the below method textStorage.addAttribute(.customCase, value: "checkList", range: paragraphRange) When I insert some text in between the text which contains the custom attribute, that text is not inheriting/propagating the custom attribute of existing paragraph text Old Text : - This is a test New Text : - This is "some new" a test The inserted part is not getting the custom attribute of the old text, Can I know why it's happening, Is it some textKit2's behaviour.
0
0
233
Dec ’24
App built with Xcode 16 crashes, worked fine with Xcode 15
I'm not a developer, so my knowledge is limited. I only know enough to update the content of my app from time to time using Xcode. The app is database driven and includes hundreds of photos. It has worked fine for years and has never crashed. However, after I updated Xcode to 16.1 my app crashes when I run it on an iOS 18 Simulator. (It works fine on an iOS 17 Simulator.) The problem seems to have something to do with UItableView. Before I spend a lot of $$ for a developer to look into this, I'm wondering if the crashes might be because of a bug that will be fixed in future. Is there any way to tell? I have the crash report, but it's very long so I won't post it unless asked to. If it's helpful, this is the section of code that crashes: // MARK: UITableViewDataSource extension DetailCollectionViewCell: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { guard let tableViewData = tableViewData else { fatalError("no tableViewData") } **Thread 1: fatal error: No tableViewData** return tableViewData.count
7
0
534
Dec ’24
Issue with willResignActiveNotification and didBecomeActiveNotification Not Triggering on Siri Setup Screen in iOS 18
Hello, I have noticed an issue in iOS 18 where UIApplication.willResignActiveNotification and UIApplication.didBecomeActiveNotification are no longer triggered when the Siri setup screen is presented or dismissed. This behavior was working as expected in iOS 17 and earlier. This change impacts the logic in our app that relies on detecting app activation and deactivation to perform critical tasks. I would like to confirm whether this change in behavior is an intentional modification in iOS 18 or an unintended bug. Thank you for your assistance. Any additional information or guidance would be greatly appreciated. Test Environment: iOS 17: Notifications triggered as expected iOS 18: willResignActiveNotification and didBecomeActiveNotification not triggered Conditions: Occurs when presenting or dismissing the Siri setup screen
1
0
303
Dec ’24
UISearchController is hidden initially until I scroll down.
I have been implementing a UISearchController, I add it to the navigationItem of the view. When the view loads, it is hidden until I scroll down to show it. I want it to be shown initially. I have changed the navigationItem.hidesSearchBarWhenScrolling to false, it solved the initial problem but I also want it to be hidden when the user is scrolling through the collectionView of the view. I am currently using Swift 6 and iOS 18+. I will add the current configuration function. private func configureSearchController() { let searchController = UISearchController() searchController.searchResultsUpdater = self searchController.searchBar.delegate = self searchController.searchBar.placeholder = "Search for a username" searchController.obscuresBackgroundDuringPresentation = false navigationItem.searchController = searchController navigationItem.hidesSearchBarWhenScrolling = false }
1
0
224
Dec ’24
tableView works properly in older iphones, but fails in newer ones
I have an ios application where I have a tab and a container view. Container view changes according to the tab I have selected. Issue I am facing is that that my table view shows all cells properly in older iphones(iphone with home button), while in newer iphones(iphone with home bar), table view doesn't scroll till the end and hides bottom cell. I have tried adding all necessary constraints and content insets, but still it is giving me same issue I have different class for tabBar, tabBar+containerView, and all related view controllers based on tab selected. Please help me find the solution to this. Thanks
0
0
195
Dec ’24
iOS18.childViewController lifecycle of UITabbarController does not execute
I have encountered a tricky problem and hope to receive help. My APP process does not exist, and then I click on the notification message of the APP to open it. At this time, my APP will first configure uitabbarccontroller, and then push the first (index=0) viewcontroller (A) from the tab to the notification message list viewcontroller (B). However, I found that on iOS18, the lifecycle of A (viewDidLoad) did not execute at the end of this process. I am sure this problem will occur stably on iOS18.1.1. Versions lower than iOS18 will not. Can someone tell me why this is?
0
0
260
Dec ’24
MFMessageComposeViewController attachments button disabled
Hello everyone! I was implementing a MFMessageComposeViewController to send messages. Currently I'm observing behaviour that attachments button is always disabled. But thing is that I'm showing MFMessageComposeViewController only when canSendText() && canSendAttachments() are true. if MFMessageComposeViewController.canSendText() && MFMessageComposeViewController.canSendAttachments() { let composeVC = MFMessageComposeViewController() composeVC.messageComposeDelegate = self composeVC.body = "Test message" self.present(composeVC, animated: true, completion: nil) } I've checked that mms are enabled.
3
0
309
Oct ’24
ios18系统 iPad 从服务器获取的带有透明图片的pdf(Data格式)文档后,document?.dataRepresentation() 转换后,透明图片背景变黑
程序从服务端获取有透明图片的pdf(Data格式)文档后, 通过PDFDocument(data: pdfData!) 加载pdf,显示正常,当我用document?.dataRepresentation()将显示的pdf转换为Data格式后再传给服务端,此时的pdf上的透明图片背景变成黑色了。只有在ios18的iPad上有此问题,ios18以下系统iPad和iPhone无此问题, ios18的iPhone也没有此问题
0
0
136
Dec ’24
UIPasteboard
To store the data, I used the following api: (nullable UIPasteboard *)pasteboardWithName:(UIPasteboardName)pasteboardName create:(BOOL)create The official document says that starting from iOS10, clipboard data does not support persistence, but from the test practice, I use this clipboard to save the data always exists, no matter uninstall and reinstall the APP, restart the phone, or even update the system, then what scenarios may lead to the clipboard data is deleted, using this scheme to store data is reliable?
0
0
135
Dec ’24
TextKit 2 : replaceContents(in:with:) is not working
I have NsTextList and it has [NsTextListElement], I want to replace an NsTextListElement with other element like NsTextParagraph or NstextListElement or an AttributedString. For some reason the below method is not working at all. And I couldn't find any alternate way of replacing the elements textLayoutManager.replaceContents(in: element.elementRange, with: NSAttributedString(string: "happy"))
2
0
319
Dec ’24
In 18.2 beta, WKWebView consumes `buildMenu`
I have a view controller that is hosing a WKWebView. My view controller overrides buildMenu(with builder: UIMenuBuilder), and prior to the beta, this was called reliably. However under 18.2 beta 4, it is not called at all, despite no code changes on my part. Things I've tried: Ensured that my responder chain is set up correctly. Walked through the debugger via a symbolic breakpoint on [UIResponder buildMenuWithBuilder:] to understand that the web view is the last object to get a buildMenuWithBuilder message. Any feedback or commiseration would be appreciated.
3
0
397
Dec ’24
Crash on [UITextField inputAssistantItem] + 68
I have a crash on 19 [UITextField inputAssistantItem] + 68 It is running on a Simulator, is this related? Details: ========= code in app ================================ numberTextField = CursorInCenterTextField() numberTextField.listener = self numberTextField.delegate = self numberTextField.textAlignment = .left numberTextField.adjustsFontSizeToFitWidth = true numberTextField.isUserInteractionEnabled = true numberTextField.inputView = UIView() numberTextField.inputAssistantItem.leadingBarButtonGroups = [] numberTextField.inputAssistantItem.trailingBarButtonGroups = [] numberTextField.font = UIFont.systemFont(ofSize: 24.0, weight: .medium) numberTextField.autocorrectionType = .no numberTextField.returnKeyType = .search ========= crash stack from ips file ======================== Incident Identifier: 50AF117D-546E-409E-8915-6E4607C83BC0 CrashReporter Key: 4AB5D894-3E17-F998-4B64-F931D05DC65D Hardware Model: Macmini9,1 Process: Glip [47003] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/83049BCF-16F7-481C-BE83-58727242A065/data/Containers/Bundle/Application/82E219BC-96B5-4A0F-AB20-D068A88C792F/Glip.app/Glip Identifier: com.glip.mobile.rc Version: 25.1.10 (132) Code Type: X86-64 (Native(?)) Role: Foreground Parent Process: launchd_sim [38628] Coalition: com.apple.CoreSimulator.SimDevice.83049BCF-16F7-481C-BE83-58727242A065 [1342] Date/Time: 2024-12-04 22:47:10.4249 +0800 Launch Time: 2024-12-04 22:47:02.4577 +0800 OS Version: macOS 14.5 (23F79) Release Type: User Baseband Version: None Report Version: 104(?) Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x00000001b3531d10 Exception Codes: 0x0000000000000001, 0x00000001b3531d10 Exception Note: EXC_CORPSE_NOTIFY(?) VM Region Info: 0x1b3531d10 is not in any region. Bytes after previous region: 3427601 Bytes before following region: 176880 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL Rosetta Generic 1b31ec000-1b31ed000 [ 4K] rw-/rwx SM=PRV ---> GAP OF 0x370000 BYTES Rosetta Generic 1b355d000-1b355e000 [ 4K] rw-/rwx SM=PRV Termination Reason: SIGNAL;[11] Segmentation fault: 11 Terminating Process: exc handler [47003] Triggered by Thread: 0 Kernel Triage: None Thread 0 name: com.apple.main-thread Thread 0 Crashed: 0 None 0x11e1e0144 0x0 + 4800250180 1 CoreUI 0x14fa08817 -[CUIStructuredThemeStore renditionWithKey:usingKeySignature:] + 406 2 CoreUI 0x14fa3e8ac -[CUICatalog _storageRefForRendition:representsODRContent:] + 94 3 CoreUI 0x14fa3b244 -[CUICatalog namedVectorGlyphWithName:scaleFactor:deviceIdiom:layoutDirection:glyphContinuousSize:glyphContinuousWeight:glyphPointSize:appearanceName:locale:] + 1909 4 CoreUI 0x14fa3b3a5 -[CUICatalog namedVectorGlyphWithName:scaleFactor:deviceIdiom:layoutDirection:glyphSize:glyphWeight:glyphPointSize:appearanceName:locale:] + 74 5 UIKitCore 0x167c4f99c __78-[_UIAssetManager imageNamed:configuration:cachingOptions:attachCatalogImage:]_block_invoke_2 + 201 6 UIKitCore 0x167c51fce __88-[_UIAssetManager _performLookUpObjectForTraitCollection:outNamedLookup:objectAccessor:]_block_invoke + 79 7 UIKitCore 0x16713340e -[UITraitCollection _enumerateThemeAppearanceNamesForLookup:] + 215 8 UIKitCore 0x167c51f3d -[_UIAssetManager _performLookUpObjectForTraitCollection:outNamedLookup:objectAccessor:] + 172 9 UIKitCore 0x167c520c0 -[_UIAssetManager _lookUpObjectForTraitCollection:objectAccessor:] + 40 10 UIKitCore 0x167c4f709 __78-[_UIAssetManager imageNamed:configuration:cachingOptions:attachCatalogImage:]_block_invoke + 849 11 UIKitCore 0x167c4f137 -[_UIAssetManager imageNamed:configuration:cachingOptions:attachCatalogImage:] + 291 12 UIKitCore 0x167c5001d -[_UIAssetManager imageNamed:configuration:] + 224 13 UIKitCore 0x1670c1b87 +[UIImage _systemImageNamed:withConfiguration:allowPrivate:] + 297 14 UIKitCore 0x167ae8cc0 +[UIAssistantBarButtonItemProvider configuredSymbolImageWithName:size:keyboardLanguageCode:] + 585 15 UIKitCore 0x167ae747e +[UIAssistantBarButtonItemProvider barButtonItemForAssistantItemStyle:target:forcePlainButton:] + 2850 16 UIKitCore 0x167ae90f1 +[UIAssistantBarButtonItemProvider defaultSystemLeadingBarButtonGroupsForItem:] + 206 17 UIKitCore 0x167ae9935 +[UIAssistantBarButtonItemProvider systemDefaultAssistantItem] + 55 18 UIKitCore 0x167719194 -[UIResponder(UIResponderInputViewAdditions) inputAssistantItem] + 67 19 UIKitCore 0x167b67898 -[UITextField inputAssistantItem] + 68 20 Glip 0x105915dbc BaseDialPadViewController.setupTopContainerViewConstraintAndSubViews() + 780 21 Glip 0x105917869 BaseDialPadViewController.setupContentViewForM1X() + 2681 22 Glip 0x105915781 BaseDialPadViewController.setupUI() + 193 ........
0
0
241
Dec ’24