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

UIKit Documentation

Post

Replies

Boosts

Views

Activity

Crash when using UIView.animateKeyframes - NSInternalInconsistencyException: You must provide a value (key=contents)
Hello, I am looking for some help today about a crash that randomly appeared for no explicit reason. A bit of context, I have 2 apps/targets within the project and the only thing that changes between the two is pretty much the API and the colors/logos. I have published an update for both apps, the related code hasn't changed since the previous versions (it has been in production for 6 months already), and it's only crashing in the same app, not in the other one somehow. It happens on multiple iOS versions and devices as well. Of course, I am unable to reproduce the crash. I am using Firebase Crashlytics, which gives me this error message : Fatal Exception: NSInternalInconsistencyException - You must provide a value (key=contents) And in the Xcode Organizer, the highlighted stack trace line responsible for the crash is the following : 3 UIKitCore 0x1c2ad5970 -[_UIViewDeferredAnimation addAnimationFrameForValue:] + 216 (UIView.m:2792) About the code, I have a custom searchBar and a cancelButton embedded in a UIStackView, I am animating the cancelButton visibility using .isHidden to replicate the experience you get when using a UISearchController in the navigationBar. About the crash, it seems to be triggered when animating keyframes using UIView.animateKeyframes, with multiple UIView.addKeyframe within the animation block, at least that's why I understand from the stack trace. The code is really simple, when the searchBarTextField becomes the first responder and begins editing, I animate the cancelButton in. The cancelButtonAnimationOptions are the followings : .curveEaseInOut, .beginFromCurrentState and .allowUserInteraction. func textFieldDidBeginEditing(_ textField: UITextField) { showSearchBarCancelButton() } func showSearchBarCancelButton() { let duration = Layout.animationDuration let options = Layout.cancelButtonAnimationOptions UIView.animateKeyframes(withDuration: duration, delay: 0, options: options, animations: { UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 1, animations: { self.cancelButton.isHidden = false self.cancelButton.superview?.layoutIfNeeded() }) UIView.addKeyframe(withRelativeStartTime: 0.7, relativeDuration: 0.3, animations: { self.cancelButton.alpha = 1 }) }) } Here is a preview of the stack trace : (Check Log.crash in the attachments for the full version) : Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x1c057de88 __exceptionPreprocess + 164 (NSException.m:202) 1 libobjc.A.dylib 0x1b98ab8d8 objc_exception_throw + 60 (objc-exception.mm:356) 2 Foundation 0x1bae99b4c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 188 (NSException.m:242) 3 UIKitCore 0x1c2ad5970 -[_UIViewDeferredAnimation addAnimationFrameForValue:] + 216 (UIView.m:2792) 4 UIKitCore 0x1c2ad5208 -[_UIViewDeferredKeyframeAnimation addAnimationFrameForValue:] + 72 (UIView.m:2901) 5 UIKitCore 0x1c2ad5148 __93-[UIViewKeyframeAnimationState addKeyframeWithRelativeStartTime:relativeDuration:animations:]_block_invoke + 368 (UIView.m:2651) 6 CoreFoundation 0x1c0587588 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__ + 24 (NSDictionaryHelpers.m:10) 7 CoreFoundation 0x1c0611bc0 -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 212 (NSDictionaryM_Common.h:311) 8 UIKitCore 0x1c2b636c8 -[UIViewKeyframeAnimationState addKeyframeWithRelativeStartTime:relativeDuration:animations:] + 156 (UIView.m:2638) 9 UIKitCore 0x1c2b635dc +[UIView(UIViewKeyframeAnimations) addKeyframeWithRelativeStartTime:relativeDuration:animations:] + 132 (UIView.m:15468) 10 MyApp 0x102b657f8 closure #1 in FavoritesViewController.showSearchBarCancelButton() + 196 (FavoritesViewController+Search.swift:45) 11 MyApp 0x102c04198 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0) 12 UIKitCore 0x1c28011e4 +[UIView _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 512 (UIView.m:15213) 13 UIKitCore 0x1c292e140 +[UIView(UIViewKeyframeAnimations) animateKeyframesWithDuration:delay:options:animations:completion:] + 156 (UIView.m:15458) 14 MyApp 0x102b655a4 FavoritesViewController.showSearchBarCancelButton() + 44 (FavoritesViewController+Search.swift:44) 15 MyApp 0x102b655a4 FavoritesViewController.textFieldDidBeginEditing(_:) + 44 (FavoritesViewController+Search.swift:12) 16 MyApp 0x102b655a4 @objc FavoritesViewController.textFieldDidBeginEditing(_:) + 224 (<compiler-generated>:11) 17 UIKitCore 0x1c2c949c8 -[UITextField _notifyDidBeginEditing] + 104 (UITextField.m:1910) 18 UIKitCore 0x1c2952554 -[UITextField _becomeFirstResponder] + 196 (UITextField.m:1842) 19 UIKitCore 0x1c294ffa4 -[UIResponder becomeFirstResponder] + 516 (UIResponder.m:392) 20 UIKitCore 0x1c294fd90 -[UIView(Hierarchy) becomeFirstResponder] + 120 (UIView.m:12379) 21 UIKitCore 0x1c2803bc4 -[UITextField becomeFirstResponder] + 152 (UITextField.m:1496) 22 MyApp 0x102ab6840 CustomSearchBar.onSearchBarTap(_:) + 36 (CustomSearchBar.swift:36) 23 MyApp 0x102ab6840 @objc CustomSearchBar.onSearchBarTap(_:) + 88 (<compiler-generated>:35) Thanks for your help!
4
0
781
Jan ’24
CameraUI SpatialVideo library error
This app allows to take photos. It works OK, but since recently I get the following error message: ERROR: PHOTO not found in table CameraUI-SpatialVideo of bundle CFBundle 0x283e96220 </System/Library/PrivateFrameworks/CameraUI.framework> (not loaded) What is this spatial video ? I'm just using still images, not using CameraUI.framework.
0
0
572
Jan ’24
Troubleshooting Custom File Extension Recognition in iOS 17 with AirDrop and UIDocumentPickerViewController
Since the release of iOS 17, my application is no longer recognized as the default option for opening my custom file extension via AirDrop. I understand that Apple has modified AirDrop functionality to integrate more closely with the Files app. However, within the Files app, my file package is erroneously identified as a folder, thus ignoring my specified file extension. Additionally, my attempts to utilize UIDocumentPickerViewController for opening these files have been unsuccessful, as it fails to recognize the file type. I have explored various approaches with UIDocumentPickerViewController, including the following implementation: let importCustomFiles = UIAlertAction(title: "Import custom file", style: .default) { _ in let myExtensionType = UTType(filenameExtension: "MyExtension")! let pickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: [myExtensionType]) pickerViewController.delegate = self pickerViewController.allowsMultipleSelection = false pickerViewController.shouldShowFileExtensions = true self.present(pickerViewController, animated: true, completion: nil) } Below is an excerpt from my Info.plist file, detailing the relevant configurations for my custom file extension: &lt;!-- MyExtension Document Type --&gt; &lt;key&gt;CFBundleDocumentTypes&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;CFBundleTypeIconFiles&lt;/key&gt; &lt;array&gt; &lt;string&gt;MyApp File Icon&lt;/string&gt; &lt;/array&gt; &lt;key&gt;CFBundleTypeName&lt;/key&gt; &lt;string&gt;Angles MyExtension&lt;/string&gt; &lt;key&gt;LSHandlerRank&lt;/key&gt; &lt;string&gt;Default&lt;/string&gt; &lt;key&gt;LSItemContentTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;au.com.mycompany.myapp.MyExtension&lt;/string&gt; &lt;/array&gt; &lt;key&gt;LSTypeIsPackage&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; &lt;/array&gt; &lt;!-- Exported Type Declaration for MyExtension --&gt; &lt;key&gt;UTExportedTypeDeclarations&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;UTTypeConformsTo&lt;/key&gt; &lt;array&gt; &lt;string&gt;public.directory&lt;/string&gt; &lt;/array&gt; &lt;key&gt;UTTypeDescription&lt;/key&gt; &lt;string&gt;Custom file extension for MyExtension files&lt;/string&gt; &lt;key&gt;UTTypeIconFiles&lt;/key&gt; &lt;array&gt; &lt;string&gt;MyApp File Icon&lt;/string&gt; &lt;/array&gt; &lt;key&gt;UTTypeIdentifier&lt;/key&gt; &lt;string&gt;au.com.mycompany.myapp.MyExtension&lt;/string&gt; &lt;key&gt;UTTypeTagSpecification&lt;/key&gt; &lt;dict&gt; &lt;key&gt;public.filename-extension&lt;/key&gt; &lt;array&gt; &lt;string&gt;myextension&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/array&gt; &lt;!-- Imported Type Declaration for MyExtension --&gt; &lt;key&gt;UTImportedTypeDeclarations&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;UTTypeConformsTo&lt;/key&gt; &lt;array&gt; &lt;string&gt;public.directory&lt;/string&gt; &lt;/array&gt; &lt;key&gt;UTTypeDescription&lt;/key&gt; &lt;string&gt;Custom file extension for MyExtension files&lt;/string&gt; &lt;key&gt;UTTypeIdentifier&lt;/key&gt; &lt;string&gt;au.com.mycompany.myapp.MyExtension&lt;/string&gt; &lt;key&gt;UTTypeTagSpecification&lt;/key&gt; &lt;dict&gt; &lt;key&gt;public.filename-extension&lt;/key&gt; &lt;array&gt; &lt;string&gt;myextension&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/array&gt; I am seeking assistance in resolving this issue so that my application can properly recognize and open files with my custom extension, both via AirDrop and within the Files app. Any insights or suggestions would be greatly appreciated.
1
0
654
Jan ’24
Avoiding rasterizing UITextView when exporting to PDF
I'm trying to render a UIView to PDF, while maintaining text elements as actual text and not rasterizing them. I'm using TextKit 2 backed UITextView and NSTextLayoutManager to provide the contents. However, no matter what I do, UITextView gets rasterized into a bitmap. Here's the basic code: let renderer = UIGraphicsPDFRenderer(bounds: pageRect, format: format) let data = renderer.pdfData { (context) in for page in self.pageViews { context.beginPage() let cgContext = context.cgContext page.layer.render(in: cgContext) } } A page view usually contains one UITextView, which uses somewhat advanced layout, so unfortunately I can't just toss it into a single NSAttributedString and draw into a CoreText context. There's a hack to get UILabels to render themselves as non-rasterized text, and if I understand correctly, it works by just actually drawing them on the current context. Interestingly, when providing UILabel view via NSTextAttachmentViewProvider to a text view using TextKit 2, the UILabels inside a text view won't get rasterized. In the image below, the paragraph is a bitmap, while the heading is real text. This hinted that the actual text fragments are the ones that get rasterized when drawing, not the whole view, and I was right. I can enumerate the text fragments and draw them directly on the context, which makes them remain as text rather than become a bitmap: page.textView?.textLayoutManager?.enumerateTextLayoutFragments(from: location, options: [.ensuresLayout, .estimatesSize, .ensuresExtraLineFragment], using: { fragment in let frame = fragment.layoutFragmentFrame fragment.draw(at: frame.origin, in: cgContext) return true }) This causes other issues, because layout coordinates will be all over the place and not confined to the text view itself (and even more so for my custom NSTextLayoutFragment class). I can get around this, but my text attachments won't get drawn this way either, but display a skewed placeholder icon: I can render them correctly on the context manually: if fragment.textAttachmentViewProviders.count > 0 { if let view = fragment.textAttachmentViewProviders.first?.view { view.layer.render(in: cgContext) return true } } This renders them at 0, 0 though. Edit: Changing bounds or frame for view/layer has no effect. I'm wondering if there is a way to make UITextView and NSTextLayoutManager to draw their contents this way automatically, so the fragments would remain as text in the PDF, rather than become a bitmap? It seems weird that the text view doesn't do this by default like it does on macOS, especially as it appears to be entirely possible. Or, if that's not possible, what's the correct way of drawing my text attachments when enumerating NSTextLayoutFragments?
2
0
753
Jan ’24
Are calls to begin and end generating device orientation notifications necessary?
UIDevice.orientationDidChangeNotification works as expected without calls to beginGeneratingDeviceOrientationNotifications() and endGeneratingDeviceOrientationNotifications() but the respective documentation for these two methods state: You must call this method before attempting to get orientation data from the device. and You call this method after a previous call to the beginGeneratingDeviceOrientationNotifications() method. Were they a requirement at one time and never deprecated?
0
0
327
Jan ’24
How do you disable support for external displays when using UISceneDelegate?
Background: We have an iOS app that supports a single window. We are using a UISceneDelegate. We do not support multiple windows or scenes. Problem: When a user mirrors the screen of their iPhone device, iOS automatically initializes a new scene with a non-interactive display role. For the time being, we would like to disable opting into this and instead simply mirror the existing device window. Going through the docs, I haven't been able to find any way of doing this. All the docs appear to assume that once you start supporting UIScene, you should automatically support any screen size, aspect ratio or connected display. In the Scenes Overview section, it claims that setting UIApplicationSupportsMultipleScenes to false will never create multiple windows, but I've confirmed under the debugger that this isn't true. Any ideas? Repro Steps: Create an iOS app with a single window that supports UISceneDelegate Launch the app on your iPhone (tested using iOS 17.3) Turn on your Apple TV From Control Center, tap the mirror icon (two small windows)
2
0
681
Jan ’24
Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
I am a beginner to swift language and with the help of apple book, I was typing this code on switching colours using buttons. then in this line: if redswitch.isOn { it is showing this fatal error. What to do I have no idea. Please help me out. Here's the code: import UIKit class ViewController: UIViewController { @IBOutlet weak var colourView: UIView! @IBOutlet weak var redswitch: UISwitch! @IBOutlet weak var greenswitch: UISwitch! @IBOutlet weak var blueswitch: UISwitch! override func viewDidLoad() { super.viewDidLoad() updateColor() // Do any additional setup after loading the view. } @IBAction func switchChanged(_sender: UISwitch){ updateColor() } func updateColor() { var red: CGFloat = 0 var green: CGFloat = 0 var blue: CGFloat = 0 if redswitch.isOn { red = 1 } if greenswitch.isOn { green = 1 } if blueswitch.isOn { blue = 1 } let color = UIColor(red: red, green: green, blue: blue, alpha: 1) colourView.backgroundColor = color } }
2
0
403
Jan ’24
How to design for 0hrs 0mins countdown timer as default (indicating timer not set).
In my app, its optional that a user sets a timer for a given thing. For that, I wanted to show 0hrs and 0 mins as default selected time interval of the countdown timer. if there is a change, the timer is automatically set to that value using event handling (did end editing). However, 0hrs and 1 mins is what the default timer shows which can come across as the timer being preset to 1 minute. How can I design my user-interface such that the default is indicated as 0hr 0mins and if the user changes it, its set to that time. This is more of a design question. Maybe something in HIG? Here is how it currently looks...
0
0
361
Feb ’24
Locallized text not loaded/showed only on some device.
Hello. I have a strange issue with localized text. On some device (iPhone X with iOS 15.2.1 and iPhone 14 Pro with iOS 16.7.2) the localized isn't loaded and the UILabel is empty. In all the others UILabel in the view the localized text is correctly showed. It works perfectly on iPhone 8 with iOS 16.4.1, iPhone 8 with iOS 16.7 iPhone 12 with iOS 17.3, and also on iPhone 14 Pro 17.2 Simulator. Below the text from the localizable file: "m_alert_message" = "E' disponibile nello store la nuova App CAME Access. Vuoi iniziare la procedura per trasferire i dati di impianto nella nuova App?"; and how set the text property of the UILabel: messageLabel.text = NSLocalizedString("m_alert_message", comment: "") messageLabel.lineBreakMode = .byWordWrapping messageLabel.textAlignment = .center messageLabel.numberOfLines = 0 messageLabel.font = UIFont(name: XipAppearance.fontName, size: XipAppearance.fontSizeText) containerView.addSubview(messageLabel) Another strange thing is all other texts in all other views are correctly loaded and showed. Does anyone have any idea what the problem might be?
3
0
698
Feb ’24
is there any other API that can return the device model number
From the below tests ran on my iPhone 12, the model and name API from UI device both return "iPhone" only, is there any other way that we can get "iPhone 12" instead of iPhone? Since the API stop returning full model information from iOS16+, we have been getting not sufficient model information for our app, so seeking for a API that does not require entitlement review/update for such purpose (as we have fail that request once before) code: print("UIDevice.current.model: (UIDevice.current.model)") print("UIDevice.current.name: (UIDevice.current.name)") log: UIDevice.current.model: iPhone UIDevice.current.name: iPhone
0
0
363
Feb ’24
Detect when AVPictureInPictureController shows black screen
Hi all, I'm using AVPictureInPictureController to show CMSampleBuffers. No problems with that. When the Picture in Picture view/window is active and the phone is locked for long enough (~30 seconds), the Picture in Picture view/window will show black. I've noticed the same happens with Netflix, so I assume there is no way around that. So when that happens (i.e. Picture in Picture view/window will showing black), I would like to just stop Picture-in-Picture mode. For this, I would need to be able to detect when Picture in Picture view/window will starts showing black pixels. I've tried listening for UIApplication lifetime events (such as didResignActive. and didMoveToBackground), but as my app is a location-based app that received Location updates in the background, those are not at all an indicator of the black PiP window. Any suggestions for me on how to handle the PiP window showing a black window upon unlocking the phone?
2
2
771
Feb ’24
_AssertAutoLayoutOnAllowedThreadsOnly
Hello. We've been collecting a lot of device feedback crashes, but we've been unable to reproduce them and can't fix them the Main Thread Checker that opened Xcode has not been able to track the specific location, but there is this crash feedback online every day. At present, I check that all devices with iOS 16.0 system or above appear, and we need the official to help us solve this intractable problem The stack in the xccrashpoint file does not provide effective stack information, so I cannot locate the specific bug. We have not been able to reproduce the problem using Xcode, so we need your assistance. I have also seen many people on the forum with similar feedback, but nothing seems to come to fruition https://developer.apple.com/forums/thread/129686?login=true&page=1#775136022 https://stackoverflow.com/questions/56791779/how-to-track-auto-layout-assertions-from-background-thread https://forums.developer.apple.com/forums/thread/661349 Launch Time: 2023-09-29 16:55:13.4225 +0800 OS Version: iPhone OS 16.7 (20H19) Release Type: User Baseband Version: 5.03.01 Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x00000001927a4c24 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [5180] Triggered by Thread: 36 Last Exception Backtrace: 0 CoreFoundation 0x18b220c44 __exceptionPreprocess + 164 (NSException.m:202) 1 libobjc.A.dylib 0x1842bfe5c objc_exception_throw + 60 (objc-exception.mm:356) 2 CoreAutoLayout 0x1a86fde68 _AssertAutoLayoutOnAllowedThreadsOnly + 328 (NSISEngine.m:0) 3 CoreAutoLayout 0x1a86f4e40 -[NSISEngine withBehaviors:performModifications:] + 36 (NSISEngine.m:1982) 4 UIKitCore 0x18d28a3a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1872 (UIView.m:18670) 5 QuartzCore 0x18c744ec4 CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10311) 6 QuartzCore 0x18c758440 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148 (CALayer.mm:2519) 7 QuartzCore 0x18c76986c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 444 (CAContextInternal.mm:2714) 8 QuartzCore 0x18c798e3c CA::Transaction::commit() + 648 (CATransactionInternal.mm:432) 9 QuartzCore 0x18c7e368c CA::Transaction::release_thread(void*) + 228 (CATransactionInternal.mm:635) 10 libsystem_pthread.dylib 0x1eb076b9c _pthread_tsd_cleanup + 620 (pthread_tsd.c:416) 11 libsystem_pthread.dylib 0x1eb079560 _pthread_exit + 84 (pthread.c:1719) 12 libsystem_pthread.dylib 0x1eb0760cc _pthread_wqthread_exit + 80 (pthread.c:2578) 13 libsystem_pthread.dylib 0x1eb075e64 _pthread_wqthread + 424 (pthread.c:2612) 14 libsystem_pthread.dylib 0x1eb075b7c start_wqthread + 8 Thread 0 name: Thread 0: 0 CoreFoundation 0x000000018b2259a8 CFStringFindWithOptionsAndLocale + 292 (CFString.c:0) 1 CoreFoundation 0x000000018b297470 -[__NSCFString hasSuffix:] + 24 (CFObject.m:523) 2 UIKitCore 0x000000018d49f48c -[UIKBTree visualStylingForScreenTraits:] + 116 (UIKBTree.m:1240) 3 UIKitCore 0x000000018d5f9828 -[UIKBTree visualStyling] + 76 (UIKBTree.m:1349) 4 UIKitCore 0x000000018dd9d72c -[UIKeyboardLayoutStar downActionFlagsForKey:] + 360 (UIKeyboardLayoutStar.m:10167) 5 UIKitCore 0x000000018dd8a6cc -[UIKeyboardLayoutStar playKeyFeedbackIfNecessaryForTouchDownOnKey:touchInfo:] + 60 (UIKeyboardLayoutStar.m:4972) 6 UIKitCore 0x000000018dd942fc -[UIKeyboardLayoutStar touchDownWithKey:withTouchInfo:atPoint:executionContext:] + 2784 (UIKeyboardLayoutStar.m:7916) 7 UIKitCore 0x000000018dd9338c -[UIKeyboardLayoutStar completeHitTestForTouchDown:executionContext:] + 1156 (UIKeyboardLayoutStar.m:7620) 8 UIKitCore 0x000000018dd92ed8 __51-[UIKeyboardLayoutStar touchDown:executionContext:]_block_invoke_2 + 272 (UIKeyboardLayoutStar.m:7518) 9 UIKitCore 0x000000018d653378 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:] + 184 (UIKeyboardTaskQueue.m:204) 10 UIKitCore 0x000000018dd8ae90 __94-[UIKeyboardLayoutStar performHitTestForTouchInfo:touchStage:executionContextPassingUIKBTree:]_block_invoke + 464 (UIKeyboardLayoutStar.m:5098) 11 UIKitCore 0x000000018d653378 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:] + 184 (UIKeyboardTaskQueue.m:204) 12 UIKitCore 0x000000018de38678 __79-[UIKeyboardImpl performHitTestForTouchEvents:executionContextPassingNSNumber:]_block_invoke_2 + 76 (UIKeyboardImpl.m:11965) 13 UIKitCore 0x000000018d65321c -[UIKeyboardTaskEntry execute:] + 208 (UIKeyboardTaskQueue.m:868) 14 UIKitCore 0x000000018d653100 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 304 (UIKeyboardTaskQueue.m:446) 15 Foundation 0x000000018551074c __NSThreadPerformPerform + 264 (NSThread.m:1046) 16 CoreFoundation 0x000000018b2ea0cc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957) 17 CoreFoundation 0x000000018b2f6758 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001) 18 CoreFoundation 0x000000018b27b578 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038) 19 CoreFoundation 0x000000018b291064 __CFRunLoopRun + 828 (CFRunLoop.c:2953) 20 CoreFoundation 0x000000018b29637c CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418) 21 GraphicsServices 0x00000001c67b835c GSEventRunModal + 164 (GSEvent.c:2196) 22 UIKitCore 0x000000018d622f58 -[UIApplication _run] + 888 (UIApplication.m:3782) 23 UIKitCore 0x000000018d622bbc UIApplicationMain + 340 (UIApplication.m:5372) 24 libswiftUIKit.dylib 0x0000000193cb40b0 UIApplicationMain(_:_:_:_:) + 104 (UIKit.swift:538) 25 SansiroLive 0x000000010283cda8 specialized static UIApplicationDelegate.main() + 28 (AppDelegate.swift:17) 26 SansiroLive 0x000000010283cda8 static AppDelegate.$main() + 28 (ThirdLoginManager.swift:0) 27 SansiroLive 0x000000010283cda8 main + 124 28 dyld 0x00000001aa7d4dec start + 2220 (dyldMain.cpp:1165)
2
0
554
Feb ’24
Cycled call textFieldShouldReturn on visionOS
Hello, community. We are adding visionOS support to our application and have an issue without a solution because of a system UIKit bug. There is a system bug with cycled recalling textFieldShouldReturn function after the first Return button usage (with this function returning true), and calling resignFirstResponder textField will get in the cycle, and there is no way to stop calling the textFieldShouldReturn func. Repro steps: Enter text to UITextField Press Return button on keyboard textFieldShouldReturn called (return true after step 4) call resignFirstResponder call becomeFirstResponder or tap on UITextField return to step 3 The same problem exists in system application Reminders. Repro steps: Create a new reminder with a title and description Set pointer to title textField Press Return button on keyboard App will try to create a new reminder and, after less than a second, return to the first reminder The bug is only for visionOS, on iOS/iPadOS all is OK. We assume that there is a flag for Return button usage, which checks on becomeFirstResponder logic, and in visionOS (iPadOS adaption), it does not clear this after handling button pressing.
0
0
363
Feb ’24
Implement a timer for an activity.
In my app, the user can set a timer for an activity. I want to show a simple progress bar that progresses every 1 second and stops (100%) at the end of the time interval of the timer. example, think of the progressbar of a song being played which finishes on the length of the song. I've read about TimerPublisher but am not sure how to implement it. Can someone help me out over here please? Thanks Neerav
4
0
671
Feb ’24
Can I schedule multi print jobs parallelly in ios using UIPrintInteractionController?
For printing from worker thread to a UIPrinter(whose url i have saved ) i am doing this and able to print : func PrintPdfDocument (pDocument:Data) { // Create a print interaction controller let printController = UIPrintInteractionController.shared // Set the printing options let printInfo = UIPrintInfo(dictionary:nil) printInfo.jobName = "Print Job " printController.printInfo = printInfo printController.showsPageRange = true // Set the PDF document to be printed printController.printingItems = pDocument printController.print(to: defaulttprinter, completionHandler: { (controller, completed, error) in if completed { print("Printing successful!") } else { if let error = error { print("Printing failed with error: \(error.localizedDescription)") } else { print("Printing was canceled.") } } }) } When i call PrintPdfDocument (pDocument:Data) function , more than once with diffrent data shown below : DispatchQueue.global().async { PrintPdfDocument (pDocument:data1) } DispatchQueue.global().async { PrintPdfDocument (pDocument:data2) } DispatchQueue.global().async { PrintPdfDocument (pDocument:data3) } Printer is printing only one document(data1) . For other call is not executing printController.print (to....) function inside PrintPdfDocument.
0
0
625
Feb ’24
iOS intermittently fails to send URLs via UISceneDelegate
I'm observing a sporadic bug in our web client where incoming URLs (triggered by a Push Notification or link tapped in another app) do not trigger either of the two expected API callbacks noted in the developer documentation for UISceneDelegate. Specifically, Apple's docs say: If your app has opted into Scenes, and your app isn’t running, the system delivers the URL to the scene(_:willConnectTo:options:) delegate method after launch, and to scene(_:openURLContexts:) when your app opens a URL while running or suspended in memory. Our client app has opted into scenes and the two callbacks mentioned above work reliably most of the time for incoming URLs. However, using the exact same test links or push notifications, I'm able to reproduce intermittent issues where I can see that neither of the above callbacks are triggered when the app is foregrounded to handle a URL. The bug seems to occur when: The app has been previously launched, and is backgrounded It's left in the background for some time (system memory pressure, from using other apps etc., might possibly play a factor also) In this scenario, sometimes when either an external link or URL via push notification is opened, I can see that neither of the two iOS delegate methods for UISceneDelegate are called. Our app is brought to the foreground correctly as though the URL will be handled, but the URL/link is not processed since it is never sent to our client. A few other notes: When the bug is repro'd using push notifications, I can see that our app receives a callback to userNotificationCenter:didReceive:, so the push notification definitely arrives. However, as noted above, the normal 2 API callbacks for UISceneDelegate are never triggered, and since those two callsites are where we handle incoming URLs, the URL from the push notification is never opened I haven't been able to observe any code in our app that precedes these hooks in our scene delegate that could be interfering. (As mentioned above, the same steps to replicate work the majority of the time) Does anyone know whether this could be a possible iOS bug? Any help/suggestions are greatly appreciated. Thank you
0
0
500
Feb ’24