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

UIKit Documentation

Post

Replies

Boosts

Views

Activity

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
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
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
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
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
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
149
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
Request for Support for GS1 Encoded QR Code Creation in iOS Swift
Hello Team, I am writing to request support for creating GS1 encoded QR codes within an iOS application developed using Swift. Our application requires the generation of QR codes that comply with GS1 standards to ensure interoperability and accurate data representation in various supply chain and logistics processes. What we have done: We have prepared a label (String) with gs1 compliant using below instructions. https://www.gs1us.org/upcs-barcodes-prefixes/gs1-128 Ex: 400PO12345678-10 241PART123 3725 10GR-BATCH 11230704 17250704 Note: There are hidden separators in above string. You can find in below attachments. But when I try to create QR code for above string using below code and scan, we are resulting that it is not GS1 encoded QRcode. func generateQRCode(from string: String) -> UIImage? { let data = string.data(using: String.Encoding.ascii) if let filter = CIFilter(name: "CIQRCodeGenerator") { filter.setValue(data, forKey: "inputMessage") filter.setValue("Q", forKey: "inputCorrectionLevel") if let outputImage = filter.outputImage { // outputImage is QR Code image return outputImage } } return nil } We generally used to create QR/BAR code above apple APIs in that we can pass different Filters to get different encoding results. But it supports very limited encodings. Apple provided the below filters : CICategoryGenerator CIAztecCodeGenerator CICode128BarcodeGenerator CIPDF417BarcodeGenerator CIQRCodeGenerator More details, please check Apple documentation link To support more encoding mechanism, we are using ZXing third party library. The following barcodes are currently supported for both encoding and decoding in Zxing library UPC-A and UPC-E EAN-8 and EAN-13 Code 39 Code 93 Code 128 ITF Codabar RSS-14 (all variants) QR Code Data Matrix Maxicode Aztec ('beta' quality) PDF 417 ('beta' quality) So unfortunately we could not find any encoding type, neither the Apple default API nor the ZXing library.  But when I use the same string to create GS1 encoding using https://barcode.tec-it.com/en/GS1DataMatrix, it is properly decoding as GS1 encoded string. Question: Is there any way to create GS1 encoded QRcode in ios either direct apple api or any third party open source library? Request: I would greatly appreciate any guidance, documentation, or library recommendations that could assist in implementing this functionality. Specifically, we are looking for: Example code or library that supports GS1 encoded QR code creation in Swift. Documentation or guidelines on implementing GS1 standards for QR codes. Any additional tools or resources that could facilitate this process. Thank you for your attention to this matter. We look forward to your assistance in integrating GS1 encoded QR code generation into our iOS application.
1
0
80
6d
Emulated GCGameController not working with non fullscreen Designed for iPad apps on MacBook
Hello, I have an iPad app that users are running on their M1 / M2 MacBooks thanks to the "Designed for iPad" feature. Some of them reported to me that the pressed keyboard keys were not recognized. According to my source code, it seems that my custom views (that are set as firstResponder) do not get pressesBegan events. While I could not reproduce this specific problem on my M1 Macbook, I found a strange problem that may be related. My view also supports interaction with game controllers. I found that the emulated controller (which is using the keyboard, when the controller emulation feature of the Designed for iPad app is set to On) has some problems. The valueChangedHandler of the GCExtendedGamepad from the GCGameController is only fired if the app is compiled with the "Requires full screen" option set to On. If Requires full screen is unchecked in XCode, the Emulated Controller is still present in the list of game controllers, but no button callbacks are triggered. Note that a real game controller connected via USB will work correctly no matter how Requires full screen is set. Could there be a focus bug of the keyboard not sending events when the app is not a full screen app (resizable on mac, and multitask on iPad)? Or is there something I can change to avoid this problem? I'm lost.
0
0
176
1w
Regression in UITabBarController on Catalyst when building under Xcode 16
I am running into an issue with UITabBarController in a Catalyst app when building under Xcode 16 and running on macOS 15. If a UITabBarController is used, the tabs are presented in an unwanted title/toolbar at the top of the window. If you have an app where your views run to the top of the window, this can obscure the content and controls that are near the top. I created a sample application that is attached to the Feedback record (FB14293963). When building under Xcode 15, this is what the app looks like: Under Xcode 16, it looks like this: Beyond this simple example, using UITabBarController in a presented view controller can result in the tabs not showing at all. Also, If you switch the view in the main window to something that isn't a UITabBarController, the tabs still remain at the top. This seems to stem from the tab bar/sidebar changes for iPadOS 18. While this approach can work for simpler apps, it may not work well at all for more complex apps and there really needs to be a way to opt out of this behavior so apps where it is not suited for can still take advantage of features in iPadOS/Catalyst 18. Has anyone discovered a workaround or way to disable the new tab bar behavior with having to write their own version of UITabBarController?
0
0
148
1w