Mac Catalyst

RSS for tag

Start building a native Mac app from your current iPad app using Mac Catalyst.

Mac Catalyst Documentation

Posts under Mac Catalyst tag

164 Posts
Sort by:
Post not yet marked as solved
0 Replies
28 Views
I have a UITableView that supports multiple selection on Mac. My table view also supports swipe actions. When a row is selected and I swipe on another table view row to expose swipe actions, UITableView discards the current selection for seemingly no reason. To reproduce: Configure a UITableView that allows multiple selection. Configure swipe actions. Run the app. Select a couple rows (via Command click or shift click). Two finger drag on the track pad to expose a swipe action on another row. Swipe to hide the swipe actions (not invoking an action). UITableView discards the entire selection for no apparent reason. Also the UITableView discards the selection without even informing the delegate (I have a label displaying the selection count in the UI and it still shows the selection count before UITableView clears the selection when a row is swiped). I don't want to discard the selection just because a swipe action is exposed. I tried working around the problem by reselecting the rows index paths in -tableView:didEndEditingRowAtIndexPath: -(void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(nullable NSIndexPath*)indexPath { //Swipe action is over..fix the selection: [self reselectIndexPathsAtTheEndOfSwipeActionEditing]; / } But when one of the selected index paths is outside the visible region of the table view scroll position jumps after programmatically reselecting the rows which looks wrong... Anyone have a workaround for this?
Posted Last updated
.
Post not yet marked as solved
0 Replies
62 Views
Everything was working fine for 4 years. But since Ventura, when the WKWebView is in focus, the keyDown event are not happening. Not only they don't fire inside of web page input box, but they won't register in the app either. As long as a WKWebView is in focus, the keyboard events won't work. The app does not receive the key events, and the web page will not receive the js events keyDown and friends. This is particularly painful with auto complete input box. Test with an empty project with only a WKWebView with this page https://www.toptal.com/developers/keycode/for/d It does work fine on iPhone and iPad. Message to Apple : You force us to use your Safari engine, yet it is always broken. Don't wait for 8 months to fix it this time, we would be tempted to go full web and skip native app with all the store certification problems.
Posted
by ShaddamIV.
Last updated
.
Post marked as solved
3 Replies
346 Views
Every time I try to upload the Mac Catalyst build of my App to App Store Connect, I get the following error: Asset validation failed This bundle is invalid. The value for key CFBundleVersion [3] in the Info.plist file must contain a higher version than that of the previously uploaded version [8]. Please find more information about CFBundleVersion at https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion (ID: 60d6b17f-ea3e-4e82-a6e6-21c18e6fb9ef) I have tried updating the version and build numbers in Xcode - still getting the same error. The Info.plist also looks fine - it just contains $(CURRENT_PROJECT_VERSION) next to Bundle version. The kicker is that I'm having no issues with uploading iOS builds - only Mac Catalyst builds. Any help would be appreciated - I've been stuck on this problem for months! I'm running Xcode 14 on macOS 12.5.1
Posted
by venkatg.
Last updated
.
Post not yet marked as solved
1 Replies
209 Views
hi all, i got the UIActivityController popup to work ok on mac catalyst, but there is no "save to files" option like on ipad / iphone. of course on ios it saves to the files app, i would just like to save the output somewhere in the users mac file system any ideas how to enable this?
Posted
by kargoedev.
Last updated
.
Post not yet marked as solved
0 Replies
79 Views
The standard Command-A keyboard shortcut in a UITextView is broken in Mac Catalyst 16/ Ventura with either TextKit 2 or TextKit 1 for long texts. In iOS 16 the selection is instant but on MacOS with Catalyst a beachball is displayed for more than 50 seconds and the app consumes gigabytes of memory. Earlier versions of Mac Catalyst work fine. To duplicate this just create a small storyBoard app with an editable UITextView and paste a long document around 1Mb then use the standard Select All Command either from the keyboard or the app menu. l I use Tale of Two Cities which is about 800k to test in my app. Is there any workaround for this?
Posted Last updated
.
Post not yet marked as solved
0 Replies
64 Views
We have just completed extensive experiments have determined that a Catalyst macOS application’s Quit can not be intercepted for the purpose of saving a “dirty” note, and for a Catalyst iOS application there is no such thing as application Quit. Has anyone figured out how to do this?
Posted Last updated
.
Post not yet marked as solved
1 Replies
102 Views
After programmatically changing the selection of a UITableview, focus gets separated from the selection if I programmatically select a cell beyond the visible region of the table view. That is to say the focused cell is not the selected cell which any user would consider wrong. To reproduce Add a button to select the "Next" row in a table (deselect the previous selected row, then select the next row just below it) Click the button. Keep clicking the button to move the table view selection down. Once you select the row outside the visible region of the table view focus cell gets separated from the selection. I created a bug report on this with a sample project: FB11803433 Trying to scroll the row visible before programmatically changing the selection doesn't always work around the issue. I experimented with -performSelector:withObject:afterDelay: calls and -setNeedsFocusUpdate and -updateFocusIfNeeded calls but it doesn't always seem to work.
Posted Last updated
.
Post not yet marked as solved
0 Replies
117 Views
I would like to change app icon on the dock programmatically. Like how calendar app changes icon from day to day. (This is about icon on the dock only, not the app icon itself.) I have done some researched and found this 'applicationIconImage' https://developer.apple.com/documentation/appkit/nsapplication/1428744-applicationiconimage But it doesn't say it is available in Mac Catalyst. Appreciate if you anyone has ideas how to do this. Thank you.
Posted
by Boonyawat.
Last updated
.
Post not yet marked as solved
1 Replies
251 Views
I've added Mac support to my iOS app and would like to add menu items when right clicking on the app icon. I was already using app shortcuts on iOS. I have a static item defined in my info.plist under the UIApplicationShortcutItems key. and I have dynamic actions I setup in applicationWillEnterForeground. Sometimes these actions appear when right clicking the app icon but most of the time they don't. Is there an example project or best practice to get this working?
Posted Last updated
.
Post not yet marked as solved
2 Replies
196 Views
NSOpenPanel.runModal is returning before the user can select a file. It seemed to get progressively worse as the OS updated. Now with macOS Ventura 13.0 it is completely unusable. Supporting docs https://stackoverflow.com/questions/70050559/nsopenpanel-nssavepanel-runmodal-dismisses-immediately-with-cancel-but-only-on https://stackoverflow.com/questions/28478020/presenting-nsopenpanel-as-sheet-synchronously
Posted
by NVisionet.
Last updated
.
Post not yet marked as solved
2 Replies
277 Views
I have a simple UIKit application that has a UITextView in a UICollectionViewCell. The app is designed for iOS/iPadOS and works just fine on those platforms. However, when run on Mac (Designed for iPad) as soon as I start scrolling the collectionview, the cpu usage spikes to ~85% and stays there indefinitely. The only way to lower the cpu is to click outside of the application window, but once it comes to the foreground again, the cpu usage jumps right back up. I've tried running on Mac in Catalyst mode too, but the same problem occurs with slightly less cpu usage (~45%). Additionally the debugger constantly spits out [API] cannot add handler to 3 from 3 - dropping while scrolling. Does anyone have an explanation or solutions for this? I’m using Xcode Version 14.1 (14B47b) on macOS Ventura 13.0 (22A380). class ViewController: UIViewController { var dataSource: UICollectionViewDiffableDataSource<Section, String>! = nil var collectionView: UICollectionView! = nil var items = Array(0...100).map{"Item \($0)"} enum Section: String { case main } override func viewDidLoad() { super.viewDidLoad() navigationItem.title = "List" configureCollectionView() configureDataSource() applyInitialSnapshot() } private func createLayout() -> UICollectionViewLayout { return UICollectionViewCompositionalLayout { sectionIndex, layoutEnvironment in let size = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(100)) let item = NSCollectionLayoutItem(layoutSize: size) let group = NSCollectionLayoutGroup.horizontal(layoutSize: size, subitems: [item]) return NSCollectionLayoutSection(group: group) } } private func configureCollectionView() { collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: createLayout()) collectionView.autoresizingMask = [.flexibleWidth, .flexibleHeight] collectionView.backgroundColor = .systemBackground view.addSubview(collectionView) } private func configureDataSource() { let cellRegistration = UICollectionView.CellRegistration<TestCell, String> { (cell, indexPath, item) in cell.configure(title: item, row: indexPath.item) } dataSource = UICollectionViewDiffableDataSource<Section, String>(collectionView: collectionView) { (collectionView, indexPath, identifier) -> UICollectionViewCell? in return collectionView.dequeueConfiguredReusableCell(using: cellRegistration, for: indexPath, item: identifier) } } private func applyInitialSnapshot() { var snapshot = NSDiffableDataSourceSnapshot<Section, String>() snapshot.appendSections([.main]) snapshot.appendItems(items) dataSource.apply(snapshot, animatingDifferences: false) } } class TestCell: UICollectionViewCell { private let annotationsTextView = UITextView() override init(frame: CGRect) { super.init(frame: frame) addViews() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func configure(title: String, row: Int) { annotationsTextView.attributedText = .init(string: "Row: \(row) Item: \(title)", attributes: [.font: UIFont.preferredFont(forTextStyle: .title1)]) } private func addViews() { annotationsTextView.isScrollEnabled = false annotationsTextView.isEditable = false annotationsTextView.translatesAutoresizingMaskIntoConstraints = false contentView.addSubview(annotationsTextView) NSLayoutConstraint.activate([ annotationsTextView.topAnchor.constraint(equalTo: contentView.topAnchor), annotationsTextView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), annotationsTextView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), annotationsTextView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor), ]) } }
Posted
by rspoon3.
Last updated
.
Post marked as solved
5 Replies
1.7k Views
Hi, I am faced with a strange problem with a Catalyst app that uses MapKit. If the map is visible and I resize the window (causing the map the resize), sometime the app crashes with some Metal related error. Is this a know issue between MapKit and Catalyst? There is something I can do in order to prevent this crash? Below you can find the error message and a screenshot of the thread that caused the crash. Thank you -[MTLDebugDevice notifyExternalReferencesNonZeroOnDealloc:]:2951: failed assertion `The following Metal object is being destroyed while still required to be alive by the command buffer 0x7f96de27f600 (label: <no label set>): <MTLToolsObject: 0x7f96dde552e0> -> <BronzeMtlTexture: 0x7f96dc04c230> label = <none> textureType = MTLTextureType2D pixelFormat = MTLPixelFormatBGRA8Unorm_sRGB width = 2372 height = 1668 depth = 1 arrayLength = 1 mipmapLevelCount = 1 sampleCount = 1 cpuCacheMode = MTLCPUCacheModeDefaultCache storageMode = MTLStorageModeManaged hazardTrackingMode = MTLHazardTrackingModeTracked resourceOptions = MTLResourceCPUCacheModeDefaultCache MTLResourceStorageModeManaged MTLResourceHazardTrackingModeTracked usage = MTLTextureUsageShaderRead MTLTextureUsageRenderTarget shareable = 0 framebufferOnly = 0 purgeableState = MTLPurgeableStateNonVolatile swizzle = [MTLTextureSwizzleRed, MTLTextureSwizzleGreen, MTLTextureSwizzleBlue, MTLTextureSwizzleAlpha] isCompressed = 0 parentTexture = <null> parentRelativeLevel = 0 parentRelativeSlice = 0 buffer = <null> bufferOffset = 0 bufferBytesPerRow = 0 iosurface = 0x0 iosurfacePlane = 0 allowGPUOptimizedContents = YES'
Posted
by DaleOne.
Last updated
.
Post not yet marked as solved
4 Replies
453 Views
We are using CNSaveRequest in CNContactStore to add contacts to system device contacts. But when calling execute method the app crashing in internal libraries.The code was working fine until macOS Monetery, In macOS Ventura beta we are facing this issue. Sample Code: let store = CNContactStore() store.requestAccess(for: .contacts, completionHandler: { isSuccess,error in guard isSuccess else { return } let contact = CNMutableContact() contact.familyName = "Hello" contact.givenName = "Contact" let request = CNSaveRequest() request.add(contact, toContainerWithIdentifier: nil) do { try store.execute(request) } catch { print(error) } }) Crash:
Posted Last updated
.
Post not yet marked as solved
8 Replies
669 Views
I would like to remove the title bar of the catalyst version of my app, but it does not work on Ventura. It used to work on Monterey. I am using AppDelegate lifecycle. I am following the official documentation: https://developer.apple.com/documentation/uikit/mac_catalyst/removing_the_title_bar_in_your_mac_app_built_with_mac_catalyst The code: func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = (scene as? UIWindowScene) else { return } #if targetEnvironment(macCatalyst) if let titlebar = windowScene.titlebar { titlebar.titleVisibility = .hidden titlebar.toolbar = nil } #endif }
Posted Last updated
.
Post not yet marked as solved
0 Replies
190 Views
On macOS it is typical for apps to have a "Done" button showing at the bottom of a window sheet. Usually the button is blue (or whatever your system accent color is set to) and this button can be invoked by pressing the return key. On NSButton all you do is assign the return key as the key equivalent. So in the Mac Catalyst environment how do I achieve this behavior? I'm able to get the button to look exactly how I want configuring UIButton like this: UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeSystem]; [doneButton setTitle:@"Done" forState:UIControlStateNormal]; doneButton.role = UIButtonRolePrimary; Is there a quick way to get its action to be invoked when the return key is pressed or do I have to manually implement UIKeyCommand? Thanks in advance to anyone who answers.
Posted Last updated
.
Post not yet marked as solved
0 Replies
195 Views
I use UNUserNotificationCenterDelegate. I'm in the process of adding new scene configurations for windows for the Mac environment. Some of these windows are auxiliary windows. So I was just wondering what happens with UNNotificationResponse targetScene property. In -userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: is it possible for one of the auxiliary window scenes to be the targetScene or does UNNotificationResponse always choose the configuration at index 0 in the info.plist?
Posted Last updated
.
Post not yet marked as solved
1 Replies
215 Views
I have a triple UISplitViewController. A UINavigationController is in the secondary column. When the selection changes in the supplementary column I call -setViewControllers:animated: and pass the navigation controller the new vc. I noticed sometimes the navigation view controller isn't updating and this logs out: setViewControllers:animated: called on while an existing transition or presentation is occurring; the navigation stack will not be updated. So this happens when the Split View controller itself is presenting another view controller modally (say a view controller with a UIActivityIndicatorView in it to show loading progress). But there is no transition/presentation occurring on the UINavigationController contained in the secondary view controller column itself. The presentation occurring on the UISplitViewController is completely separate and unrelated to the UINavigationController's navigation stack that's in the secondary column and therefore I should not be prevented from modifying the navigation stack.
Posted Last updated
.
Post not yet marked as solved
3 Replies
246 Views
Hi all When running the following code on macOS Ventura, I get the error below: (At least in a Catalyst app running on macOS.) Code to reproduce: NSString *message = @"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20"; UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"My Alert" message:message preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* yesAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {}]; [alert addAction:yesAction]; UIAlertAction* noAction = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {}]; [alert addAction:noAction]; [self presentViewController:alert animated:YES completion:nil]; Error: [Layout] Unable to simultaneously satisfy constraints: (     "<NSLayoutConstraint:0x60000265caa0 _NSAlertContentView:0x7fc0600390a0.trailingMargin == NSTextField:0x7fc06003a900.trailing   (active)>",     "<NSLayoutConstraint:0x60000265c9b0 _NSAlertImageView:0x7fc06003a460.leading == _NSAlertContentView:0x7fc0600390a0.leadingMargin   (active)>",     "<NSLayoutConstraint:0x60000265ca50 H:[_NSAlertImageView:0x7fc06003a460]-(10)-[NSTextField:0x7fc06003a900]   (active)>",     "<NSLayoutConstraint:0x60000265ca00 _NSAlertImageView:0x7fc06003a460.width == 64   (active)>" ) Will attempt to recover by breaking constraint  <NSLayoutConstraint:0x60000265ca50 H:[_NSAlertImageView:0x7fc06003a460]-(10)-[NSTextField:0x7fc06003a900]   (active)> It looks like the error happens as soon as the message is displayed with scrollbar on older macOS versions.
Posted
by techfreak.
Last updated
.