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

UIKit Documentation

Posts under UIKit tag

737 Posts
Sort by:
Post not yet marked as solved
0 Replies
27 Views
I can't override the show(_:sender:) of UIViewController or else my app freezes when the method is called (Xcode 15.3 simulator, iOS 17.4, macOS Sonoma 14.3.1, MacBook Air M1 8GB). Is there any workaround? override func show(_ vc: UIViewController, sender: Any?) { super.show(vc, sender: sender) }
Posted
by Filippo02.
Last updated
.
Post not yet marked as solved
0 Replies
42 Views
After using xcode 15 for distribution we are having strange crashes from UICollectionViewDiffableDataSource. Crash does not indicate any call stack from our own code. This happens on %100 ios 17 and with xcode 15.1 build and we can not reproduce it in testing environment. Here is the stack trace Crashed: com.apple.main-thread 0 libswiftCore.dylib 0x40369c swift_getObjectType + 40 1 UIKitCore 0x469160 __swift_destroy_boxed_opaque_existential_1Tm + 35088 2 UIKitCore 0x2633ac -[__UIDiffableDataSource collectionView:cellForItemAtIndexPath:] + 144 3 UIKitCore 0x466fd4 __swift_destroy_boxed_opaque_existential_1Tm + 26500 4 UIKitCore 0x4670e0 __swift_destroy_boxed_opaque_existential_1Tm + 26768 5 UIKitCore 0xd2194 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 668 6 UIKitCore 0x65f674 -[UICollectionView _prefetchItemsForPrefetchingContext:] + 384 7 UIKitCore 0x32204c -[UICollectionView _updatePrefetchedCells:] + 148 8 UIKitCore 0x6613fc -[UICollectionView _updateCycleIdleUntil:] + 492 9 UIKitCore 0xa69a5c ___UIUpdateCycleNotifyIdle_block_invoke + 596 10 libdispatch.dylib 0x213c _dispatch_call_block_and_release + 32 11 libdispatch.dylib 0x3dd4 _dispatch_client_callout + 20 12 libdispatch.dylib 0x125a4 _dispatch_main_queue_drain + 988 13 libdispatch.dylib 0x121b8 _dispatch_main_queue_callback_4CF + 44 14 CoreFoundation 0x3751c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 15 CoreFoundation 0x34218 __CFRunLoopRun + 1996 16 CoreFoundation 0x33968 CFRunLoopRunSpecific + 608 17 GraphicsServices 0x34e0 GSEventRunModal + 164 18 UIKitCore 0x22aedc -[UIApplication _run] + 888 19 UIKitCore 0x22a518 UIApplicationMain + 340 20 MyApp 0xd968 main + 42 (AppDelegate.swift:42) 21 ??? 0x1c8366d84 (Missing) End here is the exception: Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000 This address is always 0x0000000000000000. Anyone having the similar issue?
Posted Last updated
.
Post not yet marked as solved
0 Replies
51 Views
When I try to display a UIActivityViewController, I get funky logging in the xcode console. This is my code: @IBAction func shareAction(_ sender: Any) { // text to share let text = "Some very interesting text!" let url = Constants.URL.appStore.absoluteString guard let logo = UIImage(named: "App Logo")? .circle() .resize(333, 333) else { return } // set up activity view controller let itemsToShare: [Any] = [ logo, text, url ] let activityViewController = UIActivityViewController(activityItems: itemsToShare, applicationActivities: nil) activityViewController.popoverPresentationController?.sourceView = self.view // exclude some activity types from the list if #available(iOS 15.4, *) { activityViewController.excludedActivityTypes = [ .airDrop, .sharePlay ] } else { activityViewController.excludedActivityTypes = [ .airDrop ] } // present the Share Sheet self.present(activityViewController, animated: true, completion: nil) } The logging emerges in the console as soon as the code calls: self.present(activityViewController, animated: true, completion: nil) When I set a break point on that line, no logging occurs. If I add a completion block to that call with a break point on the first line, the logging occurs before it hits that break point. so all logging seems to be generated while displaying the UIActivityViewController. This is my logging Cannot issue sandbox extension for URL:https://apps.apple.com/app/id Couldn't read values in CFPrefsPlistSource<0x303b38900> (Domain: com.apple.country.carrier_1, User: kCFPreferencesCurrentUser, ByHost: No, Container: /var/mobile/Library/CountryBundles/, Contents Need Refresh: No): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)}> (501) personaAttributesForPersonaType for type:0 failed with error Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.mobile.usermanagerd.xpc was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.mobile.usermanagerd.xpc was invalidated: failed at lookup with error 159 - Sandbox restriction.} Received port for identifier response: <(null)> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false} elapsedCPUTimeForFrontBoard couldn't generate a task port Received port for identifier response: <(null)> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false} elapsedCPUTimeForFrontBoard couldn't generate a task port Received port for identifier response: <(null)> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false} elapsedCPUTimeForFrontBoard couldn't generate a task port <0x10640ca30> Gesture: System gesture gate timed out. Line 2, 5, 7, 9 are red the other lines are yellah I have been looking on the internet and found nothing. I have been looking in this forum, and found one possible match (without a solution): https://forums.developer.apple.com/forums/thread/746721 When looking through the logging: 'entitlement com.apple.runningboard.primitiveattribute' Should I add something to my entitlements to be allowed to show a UIActivityViewController? Is that the solution? If so: How do I add that entitlement? (or any of the other entitlements mentioned there) And since when is that required?? The app (and this feature) seem to work like a charm ... so I could ignore. Only I find it difficult to ignore RED logging by xcode. If it is red, it is bound to be kinda serious, right? Or is there a whole other reason / cause why I suddenly get this? Now running: xcode Version 15.3 (15E204a) iOS 17.4.1
Posted
by Woutster.
Last updated
.
Post not yet marked as solved
0 Replies
31 Views
Hi! I've found that when presenting a UIDocumentPickerViewController, if you quickly tap twice on a document, both the picker view controller AND its parent view controller gets dismissed. My guess is that the system simply fires off a dismissal twice, closing both views. It's easier to trigger on a simulator than on a real device. Any way to get around this? I guess it would be possible to monitor dismissals and intercept any undesired ones, but it's not great.
Posted
by Joneth.
Last updated
.
Post not yet marked as solved
0 Replies
61 Views
Hello I'm currently having some issues when using CNContactViewController in iOS 17. The problem starts after embedding the CNContactViewController inside a UINavigationController and presenting it modally. The CNContactViewController is created using the forNewContact initialiser and passing an initial value to it (CNMutableContact) Next I tap the Add Photo button, which presents the new iOS 17 Photo Editor/Picker which immediately covers all the screen. After pressing Cancel, the Photo Editor is dismissed but the "Go Home" gesture is disabled and its not possible to go to the Home Screen unless the iPhone screen is turned off and on again (this fixes the issue). This seems to be a bug in this CNContactViewController unless I'm using it incorrectly. Additionally, this is only happening when the Photo Editor is cancelled/dismissed. If the whole process of picking and editing a photo is completed, this issue does not happens and the "Go Home" gesture works as usual. Here is a code sample of how CNContactViewController being used and presented: class ContactViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let b = UIButton(type: .system) b.setTitle("Push", for: .normal) b.setTitleColor(.systemBlue, for: .normal) b.addTarget(self, action: #selector(pushAction(sender:)), for: .touchUpInside) b.translatesAutoresizingMaskIntoConstraints = false view.addSubview(b) NSLayoutConstraint.activate([ b.centerXAnchor.constraint(equalTo: view.centerXAnchor), b.centerYAnchor.constraint(equalTo: view.centerYAnchor) ]) } @objc func pushAction(sender: UIButton) { let mc = CNMutableContact() mc.givenName = "MyName" let vc = CNContactViewController(forNewContact: mc) vc.allowsActions = false vc.allowsEditing = false vc.contactStore = CNContactStore() vc.delegate = self let nc = UINavigationController(rootViewController: vc) nc.modalPresentationStyle = .fullScreen self.present(nc, animated: true) } } extension ContactViewController: CNContactViewControllerDelegate { func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) { viewController.dismiss(animated: true) } }
Posted
by diegoe.
Last updated
.
Post marked as solved
2 Replies
42 Views
I see viewIsAppearing is available on iOS 13 and above, but when I use it, found that the function not be called below iOS 16 https://developer.apple.com/documentation/uikit/uiviewcontroller/4195485-viewisappearing environment: Macos 14.4.1, Xcode 15.3 import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let sub = SubViewController() addChild(sub) view.addSubview(sub.view) } @available(iOS 13.0, *) override func viewIsAppearing(_ animated: Bool) { super.viewIsAppearing(animated) print("ViewController viewIsAppearing") } } class SubViewController: UIViewController { @available(iOS 13.0, *) override func viewIsAppearing(_ animated: Bool) { super.viewIsAppearing(animated) print("SubViewController viewIsAppearing") } } In iOS 15 devcice console log: ViewController viewIsAppearing iOS 16, 17: ViewController viewIsAppearing SubViewController viewIsAppearing
Posted
by xblian.
Last updated
.
Post not yet marked as solved
0 Replies
54 Views
The following is a screenshot of the crash stack. What caused this crash? How to solve it?
Posted
by jtyan.
Last updated
.
Post not yet marked as solved
0 Replies
33 Views
Need to implemented any type of event like local notification or log on App terminate. It should call every time when app is terminated and if app is put into the background for 1 day then also it should called. I have tried following ways applicationWillTerminate :- It will only called when user directly kill the app without putting app in background sceneDidDisconnect: - It is called when user put app in background and then terminate but is called only one time. if i again launch app and do the same steps it is not getting called.
Posted Last updated
.
Post not yet marked as solved
0 Replies
60 Views
I have encountered inconsistent paste behaviors in UITextView depending on whether the text is in English or Korean. When pasting at the beginning of a text with an English sentence in UITextView, a space is added after the pasted text. In the middle, spaces are added before and after the pasted text. However, when pasting at the end, only a space is added before the pasted text. On the other hand, when there is a Korean sentence in UITextView, pasting at the beginning results in the inclusion of "\n" at the beginning of the pasted text, while in other cases, no additional text is added upon pasting. I'm curious to know if this behavior is intentional. I would appreciate understanding the rationale behind appending "\n" in Korean text and the absence of additional text in other cases.
Posted
by pane4846.
Last updated
.
Post not yet marked as solved
0 Replies
56 Views
I am an iOS developer experiencing a crash issue related to UITableView’s footer view when using automatic dimension for the footer height calculation. The implementation is as follows: override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { return UITableView.automaticDimension } However, this leads to a crash with the following stack trace: Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000000000035f7c7 0 libobjc.A.dylib objc_release_x8 + 8 1 CoreAutoLayout -[NSContentSizeLayoutConstraint initWithLayoutItem:value:huggingPriority:compressionResistancePriority:orientation:] + 208 2 UIKitCore -[UIView _generateContentSizeConstraints] + 352 3 UIKitCore -[UIView _finishTemporaryInternalConstraints:withEngine:] + 220 4 UIKitCore __160-[UIView(UIConstraintBasedLayout) _calculatedSystemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:hasIntentionallyCollapsedHeight:]_block_invoke_2 + 192 5 CoreAutoLayout -[NSISEngine withBehaviors:performModifications:] + 84 6 UIKitCore -[UIView(UIConstraintBasedLayout) _calculatedSystemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:hasIntentionallyCollapsedHeight:] + 1072 7 UIKitCore -[UIView(AdditionalLayoutSupport) _systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:hasIntentionallyCollapsedHeight:] + 436 8 UIKitCore -[UITableView _heightForFooterView:inSection:] + 276 9 UIKitCore -[UITableView _heightForFooterInSection:] + 228 10 UIKitCore -[UISectionRowData heightForFooterInSection:canGuess:] + 64 11 UIKitCore -[UITableViewRowData rectForFooterInSection:heightCanBeGuessed:] + 256 12 UIKitCore -[UITableView _updateVisibleHeadersAndFootersNow:] + 620 13 UIKitCore -[UITableView _updateVisibleCellsNow:] + 1292 14 UIKitCore -[UITableView layoutSubviews] + 148 All UI updates in my code are performed on the main thread, and I have verified this with appropriate thread assertions. I believe the correct threading rules are being followed. I am looking for any insights or leads you may have in analyzing this crash. It seems to relate to the auto-layout constraints applied to the content size of the footer view, although my understanding is that using UITableView.automaticDimension should manage these constraints appropriately without issues. Any assistance in understanding the root cause of this issue would be greatly appreciated. If there are any known issues with automatic dimension calculation for table view footers or if additional information is required to assist in resolving this problem, please let me know. Thank you for your time and support. Best regards.
Posted
by miniLV.
Last updated
.
Post not yet marked as solved
2 Replies
81 Views
Voiceover of UIAlertController by default announces title's accessibilityTrait as static text. I'm trying to change the accessibilityTrait to be of type header and can't seem to have a direct way to access title label and modify the attribute. Only solution seems to be to add custom label to be able to modify accessibilityTrait. Now, this got me wondering should the default behavior of UIAlertController be left untouched? Have anyone else tried to do this? And, is there any other way to customize accessibilityTrait of UIAlertController title label that I'm missing out on? Thanks in advance.
Posted Last updated
.
Post not yet marked as solved
2 Replies
654 Views
I have some visualisation-heavy AUv3's, and the goal is not to perform graphics-intensive tasks if the plugin window is not opened inside the host app (such as Logic Pro). On iOS, this is easily accomplished by the viewWillAppear, etc overrides. But on macOS, it seems these overrides are not called every time the user opens / closes the plugin windows in the host application. I did try some alternate methods, like trying to traverse the view / controller hierarchy, or make use of the window property, to no avail. What substitute mechanism could I use to determine visibility status of an AUv3 on macOS? Thanks in advance, Zoltan
Posted
by znyari.
Last updated
.
Post not yet marked as solved
3 Replies
153 Views
I am developing an app which should run on Ipad, Iphone and Mac. From the app the user shall be able to press a button and copy a result (pure text) into the clipboard so it can be pasted into other apps on the same device (command + V). This works fairly well on my Ipad (or Iphone) where I use this (IOS) code: import SwiftUI import UniformTypeIdentifiers ..... UIPasteboard.general.setValue(output, forPasteboardType: UTType.plainText.identifier) .... The problem is that when I run this on "My Mac (Designed for iPad) - it does not copy the text when run on Mac as compatible iPad app. I take note that to access the clipboard on MacOS you would need another (MacOS) code like this. import Cocoa ... let pasteboard = NSPasteboard.general() pasteboard.declareTypes([NSPasteboardTypeString], owner: nil) pasteboard.setString(output, forType: NSPasteboardTypeString) .... The problem is that Cocoa can only be imported into native MacOS app - and while I recognise this could be handled with a lot of pre-processor statements separating native IOS and native MacOS code - it would highly complicate my code - and I would almost need to write the app twice just switching all the UI's to NS's. #if os(iOS) UIPasteboard.general.setValue(output, forPasteboardType: UTType.plainText.identifier) #elseif os(macOS) let pasteboard = NSPasteboard.general() pasteboard.declareTypes([NSPasteboardTypeString], owner: nil) pasteboard.setString(output, forType: NSPasteboardTypeString) #endif Even for the clipboard example it would start to complicate things. Then add to this that have have several references to other UI-classes which would be NS-classes on a MacOS. Can this be handled in a smarter way now we actually can run SwiftUI and IOS apps on a Mac???? I know one way could be to copy my output into a text-field from which the user could "Command + C" - but it is really not what I want. I hope there is something clean and smart for this - so we can assume that IOS apps can actually run on Mac with full compatibility. Thanks in advance
Posted
by Westerlin.
Last updated
.
Post not yet marked as solved
0 Replies
71 Views
Hi, I have an app for iPad, which only enables landscape mode. I'm implementing SceneDelegate and have set Requires Full Screen to true. The app behaves as expected on iPad running iOS 15 and newer. However, on iPad running iOS 14.8, the app can still rotate to portrait orientation. I have tried to implement application:supportedInterfaceOrientationsForWindow in AppDelegate and shouldAutoRotate, supportedInterfaceOrientations in the Navigation Controller and Root View Controller but none of these worked. And the app can still rotate to portrait orientation. Is is a bug in iOS 14.8? And how can I disable this? Thanks!
Posted
by long_li.
Last updated
.
Post not yet marked as solved
2 Replies
317 Views
In the iOS app I'm developing, I've noticed that since upgrading to iOS 17 (Xcode 15.1), crashes of this type occur frequently. The crashes are random and can't be reliably reproduced. Below is a typical crash report: CrashReporter Key: fd24cf14a51d73ebfc1852cccb1b8d50822b247c Hardware Model: iPhone11,2 Process: MyApp [89057] Path: /private/var/containers/Bundle/Application/06B982E0-B818-48A9-B2D1-F28999EC3BC0/MyApp.app/MyApp Identifier: com.company.MyApp Version: 2.0.0 (72) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: com.company.MyApp [4659] Date/Time: 2024-03-24 14:50:46.3982 +0800 Launch Time: 2024-03-24 14:38:38.1438 +0800 OS Version: iPhone OS 17.3.1 (21D61) Release Type: User Baseband Version: 6.00.00 Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x000000018c44e838 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [89057] Triggered by Thread: 0 Kernel Triage: VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libobjc.A.dylib 0x18c44e838 object_getClass + 48 1 Foundation 0x1930807b4 _NSKeyValueObservationInfoGetObservances + 264 2 Foundation 0x19307fc7c NSKeyValueWillChangeWithPerThreadPendingNotifications + 232 3 QuartzCore 0x19572f14c CAAnimation_setter(CAAnimation*, unsigned int, _CAValueType, void const*) + 128 4 QuartzCore 0x19574a6b4 -[CAAnimation setBeginTime:] + 52 5 QuartzCore 0x1957485b4 CA::Layer::commit_animations(CA::Transaction*, double (*)(CA::Layer*, double, void*), void (*)(CA::Layer*, CA::Render::Animation*, void*), void (*)(CA::Layer*, __CFString const*, void*), CA::Render::TimingList* (*)(CA::Layer*, void*), void*) + 740 6 QuartzCore 0x195700bf0 invocation function for block in CA::Context::commit_transaction(CA::Transaction*, double, double*) + 148 7 QuartzCore 0x195700af8 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 368 8-14QuartzCore 0x195700a84 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252 15 QuartzCore 0x195745248 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 11192 16 QuartzCore 0x19573bb80 CA::Transaction::commit() + 648 17 QuartzCore 0x19573b828 CA::Transaction::flush_as_runloop_observer(bool) + 88 18 CoreFoundation 0x1940ff7bc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 19 CoreFoundation 0x1940fe1c4 __CFRunLoopDoObservers + 548 20 CoreFoundation 0x1940fd8e0 __CFRunLoopRun + 1028 21 CoreFoundation 0x1940fd3f8 CFRunLoopRunSpecific + 608 22 GraphicsServices 0x1d768b4f8 GSEventRunModal + 164 23 UIKitCore 0x1965238a0 -[UIApplication _run] + 888 24 UIKitCore 0x196522edc UIApplicationMain + 340 25 MyApp 0x102c1f014 main + 140 26 dyld 0x1b6e52dcc start + 2240 By looking up information on the Exception Type and Termination Reason, I found that Apple officially mentions that EXC_BREAKPOINT (SIGTRAP) SIGNAL 5 Trace/BPT trap: 5 could be caused by Swift runtime error crashing mechanisms, mainly due to: If you use the ! operator to force unwrap an optional value that’s nil, or if you force a type downcast that fails with the as! operator, the Swift runtime catches these errors and intentionally crashes the app. For details, see the link: https://developer.apple.com/documentation/xcode/addressing-crashes-from-swift-runtime-errors My project is a mix of Objc+Swift compilation, the crash usually occurs after a button click triggers a change in UIView properties, mostly related to layout. All Swift code in the project is unrelated to this type of UI. So, I speculate that it might not be related to Swift runtime errors, but I'm unsure what other possible causes could lead to the aforementioned crash. A common denominator in all similar crash reports is that they occur on the main thread during system framework function calls, All show multiple instances of VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter CA::Layer::commit_if_needed is always invoked. I noticed many crashes relate to CALayer setting properties internally calling CAAnimation, so I added: @implementation CALayer (Animation) /// Prevent crashes + (void)disableAnimation:(VoidBlock)block{ [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; block(); [CATransaction commit]; } @end Using [CALayer disableAnimation:^{view.layer.someProperty = someValue;}] to disable animations has prevented some crashes, but I'm powerless in situations like the stack trace above, where all calls are made by system frameworks. I've also noticed other similar crash issues on forums: EXC_BREAKPOINT - libobjc.A.dylib object_getClass Crash on the main thread. The author experienced this issue after iOS 16 and iOS 17, with very similar stack information to mine. I suspect other potential causes might include: Whether it's related to KVO in UI code not being correctly released. Whether it involves calls to GPU resources from other threads. I've rewritten most of the code to ensure no GPU-related image operations occur on other threads during CoreAnimation runtime. Whether it's related to high memory usage and peak virtual memory. My app is related to image processing, and opening 4K photos for processing typically consumes more than 500MB of memory. If you've encountered similar situations or can help identify potential causes, please advise. Many thanks!
Posted Last updated
.
Post not yet marked as solved
1 Replies
87 Views
anyone know of latest best practices for hiding the status bar in 2024 in UIKit? the old ways no longer work they change every once in a while
Posted
by diffent.
Last updated
.
Post not yet marked as solved
1 Replies
98 Views
Hello) I use PHImageManager.default() for fetch UIImage from iOS gallery (Photo App). I noticed that screenshot images from galley has bitsPerComponent value equal 16. That's supported only in Mac OS. I could ONLY fix this by redrawing the image using UIGraphicsBeginImageContextWithOptions. private func redrawImageTo8Bit() -> UIImage? { // UIGraphicsImageRenderer can not change bitsPerComponent value UIGraphicsBeginImageContextWithOptions(size, false, UIScreen.main.scale) draw(in: CGRect(origin: .zero, size: size)) let redrawedImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return redrawedImage } https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html Example of using PHImageManager.default PHImageManager.default().requestImage( for: phAsset, targetSize: size, contentMode: contentMode, options: options ) { [weak self] image, info in if let image = image // Screenshot of an image taken on the device (iPhone 12 Pro Max) { let bitsPerComponent = image.cgImage?.bitsPerComponent // 16 } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
95 Views
I am using the category - playAndRecord and mode - videoChat with options - duckOthers. But during an audio call when I try to call setActive(true) an exception occurs and when I try to setActive(true) again after the audio call ended, I am not getting any exception, but voice is not coming. Below is what I am trying to do. So once initial session active attempt fails the system is not activating the session. I have used AVAudioSession.interruptionNotification already but still its not setting the session as desired when audio call is ended. try session.setCategory(.playAndRecord, mode: .videoChat, options: .duckOthers) try session.setActive(true)
Posted Last updated
.
Post not yet marked as solved
1 Replies
113 Views
Hello, When running an iPad app on Apple Silicon (M1) the expirationDate OptionKey of the UIPasteboard has no impact, i.e. the copied value is never removed from the clipboard. The following code works perfectly on iOS, however, behaves how I described above on macOS. let currentDate = Date() let expireDate = currentDate.addingTimeInterval(TimeInterval(90)) UIPasteboard.general.setItems([[UIPasteboard.typeAutomatic: myString]], options: [UIPasteboard.OptionsKey.expirationDate: expireDate]) Is this a bug? I am on Swift 5.10. Thank you!
Posted
by bmmcc_13.
Last updated
.