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

UIKit Documentation

Post

Replies

Boosts

Views

Activity

iOS 18 beta1/2 CoreText Crash
0 libobjc.A.dylib 0x000000018e27f008 objc_msgSend + 8 (:-1) 1 CoreFoundation 0x0000000190eaa4bc -[__NSDictionaryM objectForKey:] + 168 (NSDictionaryM.m:179) 2 CoreFoundation 0x0000000190f003e8 -[NSDictionary containsKey:] + 56 (NSDictionary.m:80) 3 CoreFoundation 0x0000000190f0006c CFDictionaryContainsKey + 52 (CFDictionary.c:265) 4 libGSFont.dylib 0x00000001af98cc14 GSFontIsOverriddenSystemFontName + 32 (GSFont.m:2860) 5 CoreText 0x0000000192d6f1fc CopyAttributeForSystemFont(__CFString const*, __CFString const*) + 64 (MetadataSupport.cpp:194) 6 CoreText 0x0000000192d6edd4 AddVariationInfo(TCFMutableDictionary&, __CFString const*) + 60 (SplicedFontSupport.cpp:6760) 7 CoreText 0x0000000192de1ea0 MakeSpliceDescriptor(__CFString const*, unsigned long, __CFString const*, __CFString const*, __CFNumber const*, __CFNumber const*, unsigned int, CTFontTextStylePlatform, unsigned int, __CFNumber co... + 4504 (SplicedFontSupport.cpp:7429) 8 CoreText 0x0000000192ddd374 TDescriptorSource::CopySpliceFontForName(__CFString const*, __CFString const*, __CFNumber const*, __CFNumber const*, CTFontLegibilityWeight, __CFBoolean const*, __CFNumber const*, __CFString const*... + 1376 (TDescriptorSource.cpp:4288) 9 CoreText 0x0000000192dda800 TDescriptorSource::CopySplicedDescriptorForName(__CFString const*, __CFString const*, __CFString const*, __CFNumber const*, __CFNumber const*, CTFontLegibilityWeight, __CFBoolean const*, __CFNumber... + 172 (TDescriptorSource.cpp:4322) 10 CoreText 0x0000000192d0a214 TDescriptor::CreateMatchingDescriptorInternal(__CFSet const*, unsigned long) const + 2332 (TDescriptor.cpp:804) 11 CoreText 0x0000000192d09148 TDescriptor::InitBaseFont(unsigned long, double) + 76 (TDescriptor.cpp:952) https://feedbackassistant.apple.com/feedback/14091158
4
1
287
3w
Sequoia Beta 4 - incorrect alert about "app wants to access data from other apps"
I have an app and a photo editing extension. I use a group container to share data between the two. That has not been a problem in the past. However, in the latest Sequoia Beta, when I try to write a file to that location, the " would like to access data from other apps" dialog appears. That's not what I'm doing, and the fact that it comes up every single launch will freak out customers. How do I read and write data to my app's group container without getting this dialog to appear? Is there a different way I am supposed to share data between an extension and an app? I filed Feedback FB14412342.
0
0
62
14h
Detect foreground/background change
In ios17 and above, I can detect when swiftUI app goes into and out of background using: @Environment(\.scenePhase) private var phase ... .onChange(of: phase) { switch phase { case .background: print("entering background...") case .active: print("entering foreground...") default: break } } Is there a straightforward way to do this in SwiftUI for ios 16? I've found some examples using UIKit, but I am not that swift (sorry, couldn't resist) with that framework.
6
0
873
Jan ’24
Specifying Item Spacing in UICollectionLayoutListConfiguration
Currently, I am using UICollectionViewCompositionalLayout to achieve the following list layout with spacing: We were thinking of trying out UICollectionLayoutListConfiguration due to its ability to support swipe actions. We would like to specify the spacing between each item. However, I do not find a way to specify item spacing in UICollectionLayoutListConfiguration. Does UICollectionLayoutListConfiguration not support item spacing, or have I missed something? Thanks.
1
0
80
2d
IosViewController not reacting when adding key command
@interface CallbackClass : NSObject (void) doSomething:(UIKeyCommand*)keycmd; (UIKeyCommand*) returnKeyCommand; @end @implementation CallbackClass (void) doSomething:(UIKeyCommand*)keycmd { NSLog(@"KEY CLICKED"); } -(UIKeyCommand*) returnKeyCommand { return [UIKeyCommand keyCommandWithInput:@"a" modifierFlags:0 action:@selector(doSomething:)]; } @end void CppClass::bindKeyCommand() { CallbackClass* callbackClass = [[CallbackClass alloc] init]; [[UIApplication sharedApplication].keyWindow.rootViewController] addKeyCommand:[callbackClass returnKeyCommand]]; } This is objective-c code that is injected into QT application with C++ and Cmake. Responder chain after executing this code: Even if this key command is present is in the responder chain i dont have any reaction on click on magic keyboard. When i do this in the pure objective-c but not with with QT, C++, Cmake project. I Detect key input but only when i add my custom view controller do the subview of QIOSViewController, but then i cany click anything else on my application then. I want to be able to detect key input or somehow inject a responder into responder chain and still being able to click things on my application.
1
0
52
3d
Customizing Drop Location View in UICollectionView Drag and Drop
Currently, this is how I implement the drag and move operation: collectionView.beginInteractiveMovementForItem collectionView.updateInteractiveMovementTargetPosition collectionView.endInteractiveMovement The outcome looks like the following: However, what I would like to achieve is the ability to customize the view of the "drop" location. For instance, in the following example, a red line is drawn at the target drop location: In this example, a transparent rectangle is drawn at the target drop location: May I know how these apps achieve such an effect? Thanks.
0
0
59
2d
iOS18 and iOS16.5.0 pushViewController crashed,But it looks like UIFont crashed,Can someone analyze that?
Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Subtype: KERN_PROTECTION_FAILURE at 0x0000000205fc4a04 Exception Codes: 0x0000000000000002, 0x0000000205fc4a04 VM Region Info: 0x205fc4a04 is in 0x205fb2cd0-0x205ff9d60; bytes after start: 73012 bytes before end: 217947 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL __DATA_CONST 205fad9c0-205fb2cd0 [ 21K] r--/rw- SM=COW .../DMCUtilities ---> unused __TEXT 205fb2cd0-205ff9d60 [ 284K] r--/rw- SM=COW ...ed lib __TEXT __DATA_CONST 205ff9d60-2060070a0 [ 53K] r--/rw- SM=COW ...lCoordination Termination Reason: SIGNAL 10 Bus error: 10 Terminating Process: exc handler [1039] Triggered by Thread: 0 Thread 0 Crashed: 0 ??? 0x0000000205fc4a04 0x0 + 8690354692 1 libsystem_pthread.dylib 0x000000021608c2fc __pthread_once_handler + 76 (pthread.c:1924) 2 libsystem_platform.dylib 0x0000000215ff2940 _os_once_callout + 32 (lock.c:1180) 3 libsystem_pthread.dylib 0x0000000216088f68 pthread_once + 100 (pthread.c:1934) 4 libFontParser.dylib 0x00000001ddd59648 TFont::CreateFontEntitiesForFile(char const*, timespec, bool, short, char const*) + 96 (Font.cpp:814) 5 libFontParser.dylib 0x00000001ddce0908 FPFontCreateFontsWithPath + 252 (FontParser.cpp:2601) 6 CoreGraphics 0x00000001b7df77f8 create_private_data_array_with_path + 20 (xt-vtable.c:109) 7 CoreGraphics 0x00000001b7dd0f30 CGFontCreateFontsWithPath + 40 (CGFontCreate.c:501) 8 CoreGraphics 0x00000001b7da76c0 CGFontCreateFontsWithURL + 672 (CGFontURL.c:315) 9 libGSFont.dylib 0x00000001d001e0b8 AddFontsFromURLOrPath + 240 (GSFont.m:996) 10 libGSFont.dylib 0x00000001d0018d1c __Initialize_block_invoke + 1404 (GSFont.m:1478) 11 libdispatch.dylib 0x00000001bd7a2eac _dispatch_client_callout + 20 (object.m:560) 12 libdispatch.dylib 0x00000001bd7a46ec _dispatch_once_callout + 32 (once.c:52) 13 libGSFont.dylib 0x00000001d0019080 Initialize + 212 (GSFont.m:1352) 14 libdispatch.dylib 0x00000001bd7a2eac _dispatch_client_callout + 20 (object.m:560) 15 libdispatch.dylib 0x00000001bd7a46ec _dispatch_once_callout + 32 (once.c:52) 16 libdispatch.dylib 0x00000001bd7a2eac _dispatch_client_callout + 20 (object.m:560) 17 libdispatch.dylib 0x00000001bd7a46ec _dispatch_once_callout + 32 (once.c:52) 18 CoreText 0x00000001b7b803c4 TDescriptorSource::TDescriptorSource() + 196 (TDescriptorSource.cpp:150) 19 CoreText 0x00000001b7b8e524 CTFontDescriptorCreateForUIType + 48 (CTFontDescriptor.cpp:571) 20 CoreText 0x00000001b7b8e240 CTFontCreateUIFontForLanguage + 20 (CTFont.cpp:181) 21 UIFoundation 0x00000001c06bdbc0 UINewFont + 840 (UIFont.m:247) 22 UIFoundation 0x00000001c06bd474 +[UIFont systemFontOfSize:traits:] + 44 (UIFont.m:1020) 23 UIKitCore 0x00000001b863265c -[_UITextAttributeDefaultCategories _genericDefaults:] + 96 (_UITextAttributeDefaults.m:98) 24 UIKitCore 0x00000001b8632534 -[_UITextAttributeDefaultCategories initWithUserInterfaceIdiom:] + 208 (_UITextAttributeDefaults.m:80) 25 UIKitCore 0x00000001b8632440 __48+[_UITextAttributeDefaults _unspecifiedDefaults]_block_invoke + 32 (_UITextAttributeDefaults.m:192) 26 libdispatch.dylib 0x00000001bd7a2eac _dispatch_client_callout + 20 (object.m:560) 27 libdispatch.dylib 0x00000001bd7a46ec _dispatch_once_callout + 32 (once.c:52) 28 UIKitCore 0x00000001b83b2044 +[_UITextAttributeDefaults _unspecifiedDefaults] + 80 (_UITextAttributeDefaults.m:191) 29 UIKitCore 0x00000001b83b1f3c +[UILabel defaultFont] + 88 (UILabel.m:660) 30 UIKitCore 0x00000001b849a020 __22-[UILabel _commonInit]_block_invoke_2 + 44 (UILabel.m:1349) 31 UIKitCore 0x00000001b83d45b0 +[UIView _performSystemAppearanceModifications:] + 72 (UIView.m:3759) 32 UIKitCore 0x00000001b83d4060 -[UILabel _commonInit] + 352 (UILabel.m:1359) 33 UIKitCore 0x00000001b83d3e18 -[UILabel initWithFrame:] + 56 (UILabel.m:1433) 34 UIKitCore 0x00000001b8521570 _UINavigationBarLargeTitleViewNewLabel + 28 (_UINavigationBarLargeTitleViewLayout.m:29) 35 UIKitCore 0x00000001b85bc7ec -[_UINavigationBarLargeTitleViewLayout initWithContentView:] + 76 (_UINavigationBarLargeTitleViewLayout.m:55) 36 UIKitCore 0x00000001b84869a0 -[_UINavigationBarLargeTitleView initWithFrame:] + 64 (_UINavigationBarLargeTitleView.m:61) 37 UIKitCore 0x00000001b8485fc4 -[_UINavigationBarVisualProviderModernIOS prepare] + 604 (_UINavigationBarVisualProviderModernIOS.m:246) 38 UIKitCore 0x00000001b8485ccc -[UINavigationBar _commonNavBarInit] + 188 (UINavigationBar.m:1444) 39 UIKitCore 0x00000001b84859a8 -[UINavigationBar initWithFrame:] + 160 (UINavigationBar.m:1495) 40 UIKitCore 0x00000001b835ab70 -[UINavigationController _navigationBarHiddenByDefault:] + 80 (UINavigationController.m:2513) 41 UIKitCore 0x00000001b835d014 -[UINavigationController loadView] + 168 (UINavigationController.m:4252) 42 UIKitCore 0x00000001b835c6a8 -[UIViewController loadViewIfRequired] + 100 (UIViewController.m:4235) 43 UIKitCore 0x00000001b835c624 -[UIViewController view] + 24 (UIViewController.m:4299) 44 UIKitCore 0x00000001b84f3524 -[UINavigationController pushViewController:transition:forceImmediate:] + 404 (UINavigationController.m:8388) 45 UIKitCore 0x00000001b84f335c -[UINavigationController pushViewController:animated:] + 628 46 DUMovie 0x0000000104e19058 -[DUNavigationController pushViewController:animated:] + 1212 (DUNavigationController:324) 47 UIKitCore 0x00000001b84e41a0 -[UINavigationController initWithRootViewController:] + 152 (UINavigationController.m:609) (UINavigationController.m:8304)
2
0
148
3d
imageData property of CNContact
After setting the imageData property of CNContact through the API, I can see in the address book that the contact's avatar has been set to the imageData image, But when my phone version is iOS 17.1.0, when this contact calls in and locks the screen, I can see that this image is displayed in full screen, But when my phone version is iOS 17.5.1, when this contact calls in, the screen is locked and the image can only be displayed on the avatar, with a blurred image in the background, After iOS 17, contacts can set their avatars and posters separately in their contact list. How can I set these two images through code, just like setting the imageData property of CNContact through API. I see that there is a parameter in the CNContact property called _fullscreenImageData, but there is no value inside, and I am unable to obtain data for this parameter. I don't know how to manipulate this data in order to achieve the effect of setting up posters in the iOS 17.5.1 system.
2
0
46
3d
QLPreviewController gets frozen after drawing in iOS17
There seem to be a regression in QLPreviewController with iOS17, since it works in both iOS16(latest) and iOS18b3. After following the steps (described below), using iOS17.X the QLPreviewController gets frozen up so all of it's top buttons are no tappable, although you can still draw on the canvas. Steps to reproduce: Setup QLPreviewController to preview a single image in png format. The QLPreviewController should be presented as the rootViewController of a UINavigationController. Present the UINavigationController that has the QLPreviewController as its rootViewController. Tap the Markup button. Pick the leftest tool from the PencilKit tools at the bottom. Draw a curvy long line from the bottom-right corner of the canvas, to the top-left corner of the canvas. Tap any of the top buttons. Current: The top buttons are not tappable. Expected: The top buttons are tappable. Any idea how to workaround/fix this issue? Notes: The issue seems to be reproducible in iOS17, and isn't reproducible in iOS16 or iOS18b3 using Xcode 15.4 and Xcode 16b3. The issue is reproducible in both iOS17 Simulator or devices. The issue is reproducible in both UIKit and SwiftUI. Possible same issue was mentioned here: https://stackoverflow.com/questions/78090416/navigation-toolbar-buttons-stop-working-after-keyboard-is-shown-on-ios-17-sw I couldn't attach a sample project to here due to file format limitation, but you can use the project from this repository and use a png instead of a pdf: https://github.com/NilCoalescing/SwiftUI-Code-Examples/tree/main/QuickLook/SwiftUIQuickLookInUINavigationController (code by Natalia Panferova) Attached is the image of the drawing done in iOS17.5 Simulator.
2
0
110
3d
Print Center on iPad: Issues Persist After Canceling and Resending Print Jobs.
Environment→ ・Device: iPad 9th generation ・OS:**iOS17.5.1 ・Printer model:EPSON PX-S730 Current issues→ 01). After canceling a print job in the Print Center, the Print Center screen on the iPad does not close. 02). When the printer is turned on and a new print job is sent, the Print Center shows the ongoing waiting job instead of proceeding with printing. Problem Description→ The AirPrint feature on an iPad 9th generation running iOS 17.5.1 is being used with an EPSON PX-S730 printer. When sending a print job while the printer is off, the Print Center shows the ongoing printing job. If the print job is canceled in the Print Center, the Print Center screen on the iPad does not close. After turning on the printer and sending the print job again, the Print Center shows the ongoing waiting job. What I want→ The Print Center screen on the iPad to close automatically after canceling a print job. Test code: Note: printController.print response is completed but Print Center status is waiting let printInfo = UIPrintInfo(dictionary: nil) printInfo.jobName = "Print Job" printController.printInfo = printInfo let pdfURL = Bundle.main.url(forResource: "sample", withExtension: "pdf")! printController.printingItem = pdfURL let printer = UIPrinter(url: printerUrl) printController.print(to: printer, completionHandler: { [self] printController, completed, error in if(error != nil){ print("error"). }else if completed{ print("completed") //this scenario handles completion response }else{ print("cancel") } })
0
0
72
3d
Printer Offline: No Error Message Received for Print Job Submission
Environment→ ・Device: iPad 9th generation ・OS:**iOS17.5.1 ・Printer model:EPSON PX-S730 Current issues→ An error message is not returned from the printer if a print job is sent while the printer is off. Problem Description→ The AirPrint feature on an iPad 9th generation running iOS 17.5.1 is being used with an EPSON PX-S730 printer. When sending a print job while the printer is off, the Print Center shows the ongoing printing job, but the printing cannot be executed because the printer is off. What I want→ I would like an error to be returned when I submit a printing job while the printer is off. Test code: Note: printController.print response is completed but Print Center status is printing let printInfo = UIPrintInfo(dictionary: nil) printInfo.jobName = "Print Job" printController.printInfo = printInfo let pdfURL = Bundle.main.url(forResource: "sample", withExtension: "pdf")! printController.printingItem = pdfURL let printer = UIPrinter(url: printerUrl) printController.print(to: printer, completionHandler: { [self] printController, completed, error in if(error != nil){ print("error"). }else if completed{ print("completed"). //this scenario handles completion response }else{ print("cancel") } })
0
0
64
3d
Launching iMessage App
Hello, I am new to app development. I am trying to make an iMessage app. I created it and then added a SwiftUI view. It builds just fine and the view is visible on the storyboard, but the app is not present in iMessage on Simulator or on an actual device. What's wrong? Thanks for any help. import UIKit import Messages import SwiftUI class MessagesViewController: MSMessagesAppViewController { var hostingController: UIHostingController<CalendarView>? override func viewDidLoad() { super.viewDidLoad() } override func willBecomeActive(with conversation: MSConversation) { super.willBecomeActive(with: conversation) let swiftUIView = CalendarView() let hostingController = UIHostingController(rootView: swiftUIView) addChild(hostingController) view.addSubview(hostingController.view) hostingController.view.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor), hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), hostingController.view.topAnchor.constraint(equalTo: view.topAnchor), hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)]) hostingController.didMove(toParent: self) self.hostingController = hostingController } override func didResignActive(with conversation: MSConversation) {} override func didReceive(_ message: MSMessage, conversation: MSConversation) {} override func didStartSending(_ message: MSMessage, conversation: MSConversation) {} override func didCancelSending(_ message: MSMessage, conversation: MSConversation) {} override func willTransition(to presentationStyle: MSMessagesAppPresentationStyle) {} override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle) {} }
1
0
388
Mar ’24