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

Posts under UIKit tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

https://forums.developer.apple.com/forums/post/question
Hi everyone, I’m working on an iOS app using both UITableViewDiffableDataSource and SwiftUI, and I’m facing two separate but puzzling issues: UITableViewDiffableDataSource Not Reusing Cells on first applying after initial Snapshot. After applying first time it is working as expected from second time. SwiftUI View’s inside UITableViewCell onDisappear Not Triggering the on first changes of snapshot after initial snapshot. With normal UITableView it is working fine. Issue causing - it is causing player & cells to retain memory extensively Sample gist code for reproducing with diffable (DiffableTableViewExampleViewController) and working fine without diffable (RegularTableViewExampleViewController) https://gist.github.com/SURYAKANTSHARMA/d83fa9e7e0de309e27485100ba5aed17 Any insights or suggestions for these issues would be greatly appreciated! Thanks in advance!
0
0
205
Jan ’25
What are the requirements of isSIMInserted api newly introduced from iOS 18 onwards
Hello Folks, I recently came through a new API introduced from iOS 18 onwards isSIMInserted and according to the document it is A Boolean property that indicates whether a SIM is present. I really appreciate Apple for introducing such an useful API but there are few queries on what are the requirements for using this API. Query 1: Do we need any special entitlements for making use of this API. ? If yes then what are those entitlements and are these entitlements available openly or we have to raise special request to apple for such entitlements? Query 2: What are the entries required to be added in info.plist for supporting the isSIMInserted api to work. Query 3: Is isSIMInserted api available for all type of apps because mine is a financial stock related app and i am looking forward to use this API for providing more security to the end user while registering through sms. As per the below link this api is only available for mobile Carrier apps but in official document there is no such mention. https://forums.developer.apple.com/forums/thread/760991 Please kindly help me on these queries ? Regards, Carol
4
0
623
Jan ’25
SwiftUI - Drag gesture blocks scroll gesture only on iPhone 11
I'm pretty new to Swift and SwiftUI. I'm making my first app for sorting a gallery with some extra features. I was using my own iPhone for testing and just started testing my app on other Apple products. Everything works fine on iPad Air M1, iPhone 15 Pro, iPhone 15 Pro Max, iPhone 13, iPhone XS (Simulator), and iPhone 11 Pro (Simulator). However, when I tried to show my app to a family member with an iPhone 11, I came across an issue. Issue Description: My app takes all photos from iPhone's native gallery, then you can sort it by some spesific filters and delete pictures. It just looks like the native gallery. (I can add photos later if needed) You can just scroll the gallery by swiping up and down. You can press the select button and start selecting pictures to delete. I recently added a drag-to-select-multiple-pictures feature. This makes it feel more like the native iOS experience, eliminating the need to tap each picture individually. However, on the iPhone 11, the moment you open the app, you can't scroll. Scrolling is completely locked. You can still select pictures by tapping or dragging, so it's not a touch area issue. The same issue persists on the iPhone 11 simulator. And I think I found the problematic part in my (sadly messy) ContentView.swift file; ScrollView { RefreshControl(coordinateSpace: .named("refresh")) { await viewModel.refreshMediaItems() } LazyVGrid(columns: gridColumns, spacing: UIDevice.current.userInterfaceIdiom == .pad ? 12 : 4) { let items = viewModel.filteredItems(typeFilter: mediaTypeFilter, specialFilter: specialFilter) ForEach(Array(zip(items.indices, items)), id: \.1.id) { index, item in MediaThumbnailView( item: item, isSelected: selectedItems.contains(item.id), viewModel: viewModel, onLongPress: { if !isSelectionMode { toggleSelectionMode() selectedItems.insert(item.id) } }, onTap: { if isSelectionMode { toggleSelection(item: item) } else { viewModel.selectItem(item) } } ) .aspectRatio(1, contentMode: .fit) .background( GeometryReader { geometry in let frame = geometry.frame(in: .named("grid")) Color.clear.preference( key: ItemBoundsPreferenceKey.self, value: [ItemBounds(id: item.id, bounds: frame, index: index)] ) } ) } } .padding(.horizontal, 2) .coordinateSpace(name: "grid") .onPreferenceChange(ItemBoundsPreferenceKey.self) { bounds in itemBounds = Dictionary(uniqueKeysWithValues: bounds.map { ($0.id, $0) }) itemIndices = Dictionary(uniqueKeysWithValues: bounds.map { ($0.id, $0.index) }) } .gesture( DragGesture(minimumDistance: 0) .onChanged { gesture in if isSelectionMode { let location = gesture.location if !isDragging { startDragging(at: location, in: itemBounds) } updateSelection(at: location, in: itemBounds) } } .onEnded { _ in endDragging() } ) } .coordinateSpace(name: "refresh") } you can see the .gesture(.... part. I realised that this DragGesture and ScrollView blocks each other (somehow only on iPhone 11) highPriorityGesture also won't work. When I change it with simultaneousGesture, scroll starts to work again. BUT - since it's simultaneous, when multiple selection mode is activated, when I'm dragging my finger gallery also starts to scroll and it becomes a very unpleasant experience. After this issue I realised on native gallery iOS locks scroll when you are dragging for multiple selection and just when you release your finger you can scroll again even if the multiple selection mode is active. I tried a million things, asked claude, chatgpt etc. etc. Found some similar issues on stackoverflow but they were all related to iOS 18, not spesific to an iPhone. My app works fine on iOS 18 (15 Pro Max) iOS 18 drag gesture blocks scrollview Here are the some of the things I've tried: using highPriorityGesture and simultenousgesture together, tried to lock the scroll briefly while dragging, implement much complicated versions of these things with the help of claude, try to check if isSelectionMode is true or not All of them broke other things/won't work. Probably there's something pretty simple that I'm just missing; but iPhone 11 being the single problematic device confuses me. I don't want to mess too much with my already fragile logic.
1
0
733
Jan ’25
SwiftUI - Drag gesture blocks scroll gesture only on iPhone 11
I'm pretty new to Swift and SwiftUI. I'm making my first app for sorting a gallery with some extra features. I was using my own iPhone for testing and just started testing my app on other Apple products. Everything works fine on iPad Air M1, iPhone 15 Pro, iPhone 15 Pro Max, iPhone 13, iPhone XS (Simulator), and iPhone 11 Pro (Simulator). However, when I tried to show my app to a family member with an iPhone 11, I came across an issue. Issue Description: My app takes all photos from iPhone's native gallery, then you can sort it by some spesific filters and delete pictures. It just looks like the native gallery. (I can add photos later if needed) You can just scroll the gallery by swiping up and down. You can press the select button and start selecting pictures to delete. I recently added a drag-to-select-multiple-pictures feature. This makes it feel more like the native iOS experience, eliminating the need to tap each picture individually. However, on the iPhone 11, the moment you open the app, you can't scroll. Scrolling is completely locked. You can still select pictures by tapping or dragging, so it's not a touch area issue. The same issue persists on the iPhone 11 simulator. And I think I found the problematic part in my (sadly messy) ContentView.swift file; ScrollView { RefreshControl(coordinateSpace: .named("refresh")) { await viewModel.refreshMediaItems() } LazyVGrid(columns: gridColumns, spacing: UIDevice.current.userInterfaceIdiom == .pad ? 12 : 4) { let items = viewModel.filteredItems(typeFilter: mediaTypeFilter, specialFilter: specialFilter) ForEach(Array(zip(items.indices, items)), id: \.1.id) { index, item in MediaThumbnailView( item: item, isSelected: selectedItems.contains(item.id), viewModel: viewModel, onLongPress: { if !isSelectionMode { toggleSelectionMode() selectedItems.insert(item.id) } }, onTap: { if isSelectionMode { toggleSelection(item: item) } else { viewModel.selectItem(item) } } ) .aspectRatio(1, contentMode: .fit) .background( GeometryReader { geometry in let frame = geometry.frame(in: .named("grid")) Color.clear.preference( key: ItemBoundsPreferenceKey.self, value: [ItemBounds(id: item.id, bounds: frame, index: index)] ) } ) } } .padding(.horizontal, 2) .coordinateSpace(name: "grid") .onPreferenceChange(ItemBoundsPreferenceKey.self) { bounds in itemBounds = Dictionary(uniqueKeysWithValues: bounds.map { ($0.id, $0) }) itemIndices = Dictionary(uniqueKeysWithValues: bounds.map { ($0.id, $0.index) }) } .gesture( DragGesture(minimumDistance: 0) .onChanged { gesture in if isSelectionMode { let location = gesture.location if !isDragging { startDragging(at: location, in: itemBounds) } updateSelection(at: location, in: itemBounds) } } .onEnded { _ in endDragging() } ) } .coordinateSpace(name: "refresh") } you can see the .gesture(.... part. I realised that this DragGesture and ScrollView blocks each other (somehow only on iPhone 11) highPriorityGesture also won't work. When I change it with simultaneousGesture, scroll starts to work again. BUT - since it's simultaneous, when multiple selection mode is activated, when I'm dragging my finger gallery also starts to scroll and it becomes a very unpleasant experience. After this issue I realised on native gallery iOS locks scroll when you are dragging for multiple selection and just when you release your finger you can scroll again even if the multiple selection mode is active. I tried a million things, asked claude, chatgpt etc. etc. Found some similar issues on stackoverflow but they were all related to iOS 18, not spesific to an iPhone. My app works fine on iOS 18 (15 Pro Max) iOS 18 drag gesture blocks scrollview Here are the some of the things I've tried: using highPriorityGesture and simultenousgesture together, tried to lock the scroll briefly while dragging, implement much complicated versions of these things with the help of claude, try to check if isSelectionMode is true or not All of them broke other things/won't work. Probably there's something pretty simple that I'm just missing; but iPhone 11 being the single problematic device confuses me. I don't want to mess too much with my already fragile logic.
1
0
284
Jan ’25
Basic HTML converted to NSAttributedString is not rendered correctly
We have a sample code that initialises an NSAttributed string with simple HTML code and the result differs massively since XCode 16 and iPadOS 18 SDK. DESCRIPTION OF PROBLEM Since Xcode Version 16.1 HTML content passed into an NSAttributedString is not rendered correctly. Specifically, enumeration characters (such as bullet points or numbers) and the proper indentation for text within list items are missing. As a result, the structure of the HTML content, especially ordered and unordered lists, is not displayed as expected. STEPS TO REPRODUCE A UILabel was added to the view in a new Objective-C project in Xcode. A HTML string containing and Tags was converted into an NSAttributedString (With NSAttributedString::initWithData and NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType Parameter)within the viewDidLoad method and assigned to the UILabel. Expected Result: The lists should be displayed correctly with enumeration characters and appropriate indentation, as shown in the attached screenshot expected_result.jpeg. Same Code still works as expected using XCode 15.x Actual Result: The list is displayed without enumeration characters or indentation, which matches the attached screenshot actual_result.jpeg. Sample Code NSString *html = @"Es ist wichtig, dass Sie Ihren Arzt informieren:\n<ol>\n\t<li><strong>HIER !!!!!!! </strong>Wenn Sie gegenw&auml;rtig mit Zometa&reg;, dass die gleiche aktive Substanz enth&auml;lt wie Aclasta&reg; behandelt werden.</li>\n</ol>\n\n<ul>\n\t<li><strong>Hier !!!!!!</strong> Wenn Sie Nierenbeschwerden haben oder hatten, denn Ihre Nieren m&uuml;ssen korrekt funktionieren, um das &uuml;berfl&uuml;ssige Aclasta &reg; das f&uuml;r Ihre Knochen nicht ben&ouml;tigt wird, ausscheiden zu k&ouml;nnen.</li>\n\t<li>Wenn sie Medikamente einnehmen, die Kortsion als Bestandteil enthalten (z. B. Prendisolon oder Dexamethason)</li>\n\t<li>Wenn sie unter schlechter Zahngesundheit oder Zahnfleischerkrankungen leiden oder wenn eine Zahnextraktion geplant ist</li>\n</ul>\n"; NSString *textAttr = [NSString stringWithFormat:@"<span style=\"font-family:Arial; line-height: 80%%; font-size:10px;\">%@</style>", html]; NSData *data = [textAttr dataUsingEncoding:NSUTF16StringEncoding]; NSAttributedString *string = [[NSAttributedString alloc] initWithData:data options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF16StringEncoding)} documentAttributes:nil error:nil]; self.label.numberOfLines = 0; self.label.attributedText = string; Greetings
4
1
954
Jan ’25
iOS18 UIPinchGestureRecognizer finger change
Before ios18, when two fingers are switched to single fingers, the printing scale value will not change. When switching to two fingers again, the pinch and zoom printing scale will change. The same operation is performed after ios18, and two fingers are switched to single fingers. Switch back to two fingers, and the scale printing will not change. code here: - (void)pinchGesture:(UIPinchGestureRecognizer *)recognizer { NSSet <UIEvent*> *events = [recognizer valueForKey:@"_activeEvents"]; UIEvent *event = [events anyObject]; if (recognizer.state == UIGestureRecognizerStateBegan) { NSLog(@"---- begin finger count: %d scale: %f",event.allTouches.count,recognizer.scale); recognizer.scale = 1.0; } else if (recognizer.state == UIGestureRecognizerStateChanged) { NSLog(@"---- change finger count: %d scale: %f",event.allTouches.count,recognizer.scale); // recognizer.scale = 1.0; } log image for iOS 17.7 log image for ios18.0.2
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
259
Jan ’25
How to suppress the prohibition mark (🚫) in UITableView drag-and-drop operations?
Question How can I suppress this prohibition mark during this operation? Background I am implementing drag-and-drop functionality in a UITableView to allow users to reorder cells. During the drag operation, when a cell is dragged back to its original position, a prohibition mark (🚫) appears over the cell. I have reviewed the API documentation for UITableViewDragDelegate and UITableViewDropDelegate, but I could not find any clear way to suppress this mark. The behavior does not impact functionality but is visually unappealing. What I Tried Customizing UITableViewDropProposal: I ensured that operation is set to .move and intent to .insertAtDestinationIndexPath. This did not resolve the issue. Customizing drag preview: Using dragPreviewParametersForRowAt to set a clear background. The prohibition mark still appeared. Verifying drop session: Checked the UIDropSession state in dropSessionDidUpdate to ensure valid drop handling. Environment Xcode Version: Version 16.2 Testing Device: iPhone 16 pro + iOS 18.2 Steps to Reproduce Code Example Create new app with this ViewController import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UITableViewDragDelegate, UITableViewDropDelegate { let tableView = UITableView() var items = ["Item 1", "Item 2", "Item 3", "Item 4"] override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white tableView.delegate = self tableView.dataSource = self tableView.dragDelegate = self tableView.dropDelegate = self tableView.dragInteractionEnabled = true tableView.translatesAutoresizingMaskIntoConstraints = false tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell") tableView.separatorStyle = .none tableView.layer.cornerRadius = 10 tableView.backgroundColor = UIColor.systemGray6 view.addSubview(tableView) NSLayoutConstraint.activate([ tableView.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.5), tableView.centerXAnchor.constraint(equalTo: view.centerXAnchor), tableView.topAnchor.constraint(equalTo: view.topAnchor, constant: 50), tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -50) ]) } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return items.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) cell.textLabel?.text = items[indexPath.row] cell.textLabel?.textAlignment = .center cell.backgroundColor = UIColor.systemBlue.withAlphaComponent(0.2) cell.layer.cornerRadius = 10 cell.clipsToBounds = true return cell } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 60 } func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] { let dragItem = UIDragItem(itemProvider: NSItemProvider(object: items[indexPath.row] as NSString)) dragItem.localObject = items[indexPath.row] return [dragItem] } func tableView(_ tableView: UITableView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UITableViewDropProposal { guard destinationIndexPath != nil else { return UITableViewDropProposal(operation: .cancel) } return UITableViewDropProposal(operation: .move, intent: .insertAtDestinationIndexPath) } func tableView(_ tableView: UITableView, performDropWith coordinator: UITableViewDropCoordinator) { guard let destinationIndexPath = coordinator.destinationIndexPath, let dragItem = coordinator.items.first?.dragItem.localObject as? String else { return } if let sourceIndex = items.firstIndex(of: dragItem) { tableView.performBatchUpdates { items.remove(at: sourceIndex) items.insert(dragItem, at: destinationIndexPath.row) tableView.moveRow(at: IndexPath(row: sourceIndex, section: 0), to: destinationIndexPath) } coordinator.drop(coordinator.items.first!.dragItem, toRowAt: destinationIndexPath) } } } Run simulator and start dragging a cell without moving it to a different position. Observe that a prohibition mark appears at the upper right of the cell Any guidance would be greatly appreciated. Thank you in advance!
1
0
341
Jan ’25
view controller life cycle bug in xcode 16 ios 18
hi does any one know if there changes in lifecycle in xcode 16 ios 18 cause i notice that my view will appear does what view didappear use to do in older version and it kind of a problem cause all the rest of ios work diffrently does anyone else found a problem with it? or does anyone know if there was a known change to life cycles
0
0
400
Jan ’25
MacCatalyst Scene Frame needs adjustment
I don't know why, but for my MacCatalyst target, I have to make my view controller Y orgin 36 and the subtract the view height by 36 points, or the view is clipped. The following works in my main UIViewController, but feels super hacky. I'd feel better if I understood the issue and addressed it properly. override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() #if targetEnvironment(macCatalyst) if view.frame.origin.y < 1 { let f = UIApplication.shared.sceneBounds let newFrame = CGRect(x: 0.0, y: 36, width: f.size.width, height: f.size.height - 36) self.view.frame = newFrame } #endif } My guess is it starts the view under the title bar, but I have these set in the view controller: self.extendedLayoutIncludesOpaqueBars = false self.edgesForExtendedLayout = []
1
0
411
Jan ’25
Regarding the issue of navigation bar hierarchy in iOS 18
I have discovered a strange phenomenon about iOS18.1.1. I set a logo as the titleView in my navigationBar, and then when I added a view to the navigationBar and pushed it to another page before popping it back up, I found that the view hierarchy of the navigationBar would change in a very short time. In this short time, the logo would cover the view. I did not find this phenomenon on devices below iOS18.1.1. I would like to know what changes have occurred in iOS18.1.1 that caused the view hierarchy to change during the pop process. I hope someone can help me. Thank you very much
3
0
638
Jan ’25
About the button arrangement of AlertController
I encountered an issue while using the AlertController. When I added two buttons (cancel, confirm), they were arranged left and right. When the word count of the two buttons was high, they became arranged vertically. I would like to know what changes this adaptive arrangement is based on? Or, when the word count of a button exceeds a certain limit, it will become arranged in a top and bottom sequence? I did not find any explanation about this in the development documentation. I hope someone can help me. Thank you very much.
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
307
Jan ’25
BUG: screen flicker on quick tap / swipe to go back
I have found a system bug with UINavigationController, UIGestureRecognizerDelegate mainly the swipe back control. I have reproduced this in many apps, while some that use custom swipe back i can not reproduce, however any app using default uikit/swift transitions i can reproduce the flicker/previous screen flashing The Bug: a slight tap or series of quick taps anywhere on the screen (with the slightest (1-2pt -x)confuse the system into thinking its a swipe back gesture, however instead of pushing back to previous screen the UI flickers and flashes the previous screen. for a split second, very easy to reproduce. on screens with lots of options of boxes to tap it happens quite often. I have removed all custom "swipe back from anywhere" logic, all custom gesture logic, and can still reproduce by tapping the edge of the screen with only UINavigationController, UIGestureRecognizerDelegate in my navigation controller. Please let me know the best way to get in contact with someone at apple to either build an extension to prevent this flicker or if a developer has a fix but this is rarely talked about. (velocity limits etc do not work, and just make the gesture feel awful) all the developers i have reached out too have looked into this and have said "its an ios bug, only fix is build a custom swipe back from anywhere, or wait for apple to fix it).... as a small indie app, building my own seems daunting Recap: quick or taps with small x movement flash previous screen instead of pushing back or simply recognizing it as a tap and not flashing previous screen. this happens with no custom code default uikit/swift. Link me your app i can probably reproduce it, I have reproduced it in X(was hard), Retro(easy), and many more. The goal is to have a smooth native swipe/drag back from anywhere gesture while preventing flicking on fast taps or short taps with minor x movement. i have tried everything from setting limits to -x, velocity limits etc. nothing fixes this. happy hacking! PS i hope someone at apple calls me and i can explain this and we can fix it for every app in an update.
2
0
482
Mar ’25
iOS app crash at -[UIView _wrappedProcessTraitChanges:withBehavior:] + 1288 (UIView.m:0)
Hello Apple engineers, could you help me understand whether this crash is a UIKit bug or something in our code that causes it. Based on the documentation it is an invalid fetch instruction, that's why I suspect UIKit. I've found a similar crash here on the forums reported a year ago, it seemed to be a UIKit bug - https://forums.developer.apple.com/forums/thread/729448. I've attached the full crash report (the app name was replaced with ): Thread 0 Crashed: 0 libobjc.A.dylib 0x000000019daf7c20 objc_msgSend + 32 (:-1) 1 UIKitCore 0x00000001a3020c50 -[UIView _wrappedProcessTraitChanges:withBehavior:] + 1288 (UIView.m:0) 2 UIKitCore 0x00000001a3020720 -[UIView _processChangesFromOldTraits:toCurrentTraits:withBehavior:] + 196 (UIView.m:7840) 3 UIKitCore 0x00000001a3020618 -[UIView _updateTraitCollectionAndProcessChangesWithBehavior:previousCollection:] + 112 (UIView.m:7831) 4 UIKitCore 0x00000001a2fa90c0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 944 (UIView.m:19850) 5 QuartzCore 0x00000001a22dfc28 CA::Layer::layout_if_needed(CA::Transaction*) + 496 (CALayer.mm:10944) 6 QuartzCore 0x00000001a22df7b4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148 (CALayer.mm:2638) 7 QuartzCore 0x00000001a2336914 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 472 (CAContextInternal.mm:2613) 8 QuartzCore 0x00000001a22b57c4 CA::Transaction::commit() + 648 (CATransactionInternal.mm:420) 9 QuartzCore 0x00000001a22f8a0c CA::Transaction::flush_as_runloop_observer(bool) + 88 (CATransactionInternal.mm:928) 10 UIKitCore 0x00000001a303f568 _UIApplicationFlushCATransaction + 52 (UIApplication.m:3326) 11 UIKitCore 0x00000001a303cb64 __setupUpdateSequence_block_invoke_2 + 332 (_UIUpdateScheduler.m:1652) 12 UIKitCore 0x00000001a303c9d8 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:136) 13 UIKitCore 0x00000001a303c628 schedulerStepScheduledMainSection + 172 (_UIUpdateScheduler.m:1171) 14 UIKitCore 0x00000001a303d59c runloopSourceCallback + 92 (_UIUpdateScheduler.m:1334) 15 CoreFoundation 0x00000001a080c328 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1970) 16 CoreFoundation 0x00000001a080c2bc __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2014) 17 CoreFoundation 0x00000001a0809dc0 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2051) 18 CoreFoundation 0x00000001a0808fbc __CFRunLoopRun + 840 (CFRunLoop.c:2969) 19 CoreFoundation 0x00000001a0808830 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434) 20 GraphicsServices 0x00000001ec7e81c4 GSEventRunModal + 164 (GSEvent.c:2196) 21 UIKitCore 0x00000001a336eeb0 -[UIApplication _run] + 816 (UIApplication.m:3844) 22 UIKitCore 0x00000001a341d5b4 UIApplicationMain + 340 (UIApplication.m:5496) 23 UIKitCore 0x00000001a3757fa8 UIApplicationMain(_:_:_:_:) + 104 (UIKit.swift:565) 24 <Redacted> 0x00000001028bde64 specialized static UIApplicationDelegate.main() + 28 (/<compiler-generated>:16) 25 <Redacted> 0x00000001028bde64 static AppDelegate.$main() + 28 (AppDelegate.swift:0) 26 <Redacted> 0x00000001028bde64 main + 116 27 dyld 0x00000001c61f6ec8 start + 2724 (dyldMain.cpp:1334) 2024-12-27_20-53-28.2129_-0500-353aaa194e6232c0d1fae767296bdb8c47c30498.crash
2
1
498
Dec ’24
Could someone test if Settings in iOS 18.2 are broken ?
Apparently, settings do not show anymore the apps settings in iOS 18.2. I tested on simulators (Xcode 16.2) both on iOS 18.1 and iOS 18.2 and got very different results: In iOS 18.1 simulator, I see the settings of a lot of apps. In iOS 18.2 simulator, not a single app setting. That is a really serious issue in simulator for development (I filed a bug report FB16175635), but would be really critical on device as it would make it impossible to adjust setting of many apps. Unless I missed something (meta setting ?) in iOS 18.2 ? I have not upgraded to 18.2 notably for this reason. So I would appreciate if someone who has upgraded could make the test and report ? select Settings on Home page scroll to Apps category tap here to access the list Does the list show anything ? Thanks for your help.
1
1
1k
Jan ’25
UIColor labelColor in macOS made-for-iPad app is not solid black
When my iOS app runs on macOS in "designed for iPad" mode, the system foreground colour RGBA values seem strange. Looking at [UIColor labelColor], [UIColor secondaryLabelColor] etc. on iOS, I see values like these: (Light Mode) // R G B A fg0 = 0 0 0 255 fg1 = 10 10 13 153 fg2 = 10 10 13 76 fg3 = 10 10 13 45 Note in particular that fg0, aka labelColor, is solid black. When I run it on my Mac, the values I see are: // R G B A fg0 = 0 0 0 216 fg1 = 0 0 0 127 fg2 = 0 0 0 66 fg3 = 0 0 0 25 Here, fg0 has alpha = 216. The result is that it looks like a dark grey, on a white background. Of course it's reasonable for macOS to have a different colour palette than iOS - but native macOS apps seem to have solid 100% black as their foreground colour. Do others see this? What should I be doing? Note that I'm getting colour values using UIColor's getRed: blue: green: alpha: method and then using these colour values for some custom GPU drawing. Previously I was using solid black and white, but at some point I updated it to use UIColor in order to respond to light/dark-mode changes.
0
0
396
Dec ’24
otential Optimization or Bug in UINavigationController Push Operation in iOS 18
Issue Description: In iOS 18, when setting the root view controller of a UINavigationController and immediately pushing another view controller, the root view controller's lifecycle methods, such as viewDidLoad(), are not called as expected. This issue does not occur in previous iOS versions. There is no mention of this behavior in the iOS 18 release notes, and it is causing significant issues in our application. Steps to Reproduce: Set the root view controller of a UINavigationController. Immediately push another view controller. Observe that the root view controller's lifecycle methods, such as viewDidLoad(), are not called. Example Code: Swift import UIKit class HomeViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() print("HomeViewController viewDidLoad") } } class SecondViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() print("SecondViewController viewDidLoad") } } @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { window = UIWindow(frame: UIScreen.main.bounds) let home = HomeViewController() let rootNav = UINavigationController(rootViewController: home) window?.rootViewController = rootNav window?.makeKeyAndVisible() let secondViewController = SecondViewController() home.navigationController?.pushViewController(secondViewController, animated: true) return true } } Expected Behavior: The root view controller's lifecycle methods, such as viewDidLoad(), should be called when setting it as the root view controller of a UINavigationController. Actual Behavior: In iOS 18, the root view controller's lifecycle methods are not called when it is set as the root view controller and another view controller is immediately pushed. Impact: This issue affects the proper initialization and setup of the root view controller, causing significant disruptions in our application's workflow. Device Information: iOS Version: iOS 18 Test Devices: iPhone 15, iPhone 16 Additional Information: We would appreciate any insights or updates on whether this is an intended optimization or a potential bug. This issue is causing significant disruption to our application, and a timely resolution would be greatly appreciated.
3
0
427
Dec ’24
Converting iPad app to an iPhone app
I have an iPad developed using UIKit and storyboards now I have to develop UI for iPhone. Designs for iPhone app are completely new from iPad app also navigation is different. I have question regarding should I make different view controllers for iPhone and iPad and different storyboard
Topic: Design SubTopic: General Tags:
2
0
462
Jan ’25
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
945
Jan ’25
UIViewController.view.backgroundColor auto changed when present
This is easy to reproduce,in dark mode, 2 UIViewControllers A and B, A present B. code: class AAA: UIViewController { override func viewDidLoad() { super.viewDidLoad() navigationItem.title = "AAA" view.backgroundColor = .systemBackground } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { present(UINavigationController(rootViewController: BBB()), animated: true) } } class BBB: UIViewController { override func viewDidLoad() { super.viewDidLoad() navigationItem.title = "BBB" view.backgroundColor = .systemBackground } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { dismiss(animated: true) } } before present: after present: Obviously, the backgroundColor of the view has changed. I guess it's because view's backgroundColor is the same as the the window, so changed the color to distinguish between the controller and the background, but this brought unexpected changes which is confusing. I want to know how this happened and how I can manually control it
1
0
273
Jan ’25