Post not yet marked as solved
iPadOS apps running via Catalyst on macOS now insert a tab character in UITextField when the tab is typed. When running in macOS 12.2 typing a tab character focused on the next UITextField.
The same code/app running on iPadOS (device or simulator) responds by focusing on the next UITextField when a tab is typed.
Was this a purposeful change in Catalyst? I have not been able to find anything that talks about this. And it is impacting the usability of our app in cases where we have multiple UITextFields present.
Post not yet marked as solved
In an app ported to Mac Catalyst, the camera interface always turned out to be blank.I have checked: the capabilities includes "Camera", the privacy setting in info.plist is there (the iPad app shows the camera fine), and I even try to include front camera for UIImagePickerController. if UIImagePickerController.isSourceTypeAvailable(.camera) { let imagePicker = UIImagePickerController() imagePicker.sourceType = .camera imagePicker.delegate = self imagePicker.cameraDevice = .front // added for Mac self.present(imagePicker, animated:true, completion:nil) }The error I got is: "[Generic] Could not create video device input: Error Domain=AVFoundationErrorDomain Code=-11814"
Post not yet marked as solved
Hi,
I enabled Mac Catalyst (macOS12.1) for an app, set Optimise Interface for Mac with the following code. The code can be compiled with "Build Succeeded" and can be run successfully on an M1 Mac. However the editor will flag out the following:
'horizontalSizeClass' is unavailable in macOS
and with build time issues. If I use UIViewControllerRepresentable it will give
Cannot find type 'UIViewControllerRepresentable' in scope
The app does run ok. Am I missing something?
import SwiftUI
struct ContentView: View {
@Environment(.horizontalSizeClass) var horizontalSizeClass: UserInterfaceSizeClass?
var body: some View {
if horizontalSizeClass == .compact {
Text("Compact")
} else {
Text("Regular")
}
}
}
Thanks in advance.
Post not yet marked as solved
I'm working on an iPad app, which I want to be able to run properly on the M1 Mac. I am not using Mac Catalyst because I am using OpenGL, which is not available for Catalyst. Instead, I am targeting "My Mac(Designed for iPad) when I build for the M1 Mac.
I would like to know when my app has been placed in full screen mode (when running on the M1 Mac). MacOS (AppKit?) provides the "NSWindowDidEnterFullScreenNotification" to help with this.
In general, I'd love to be able to access these "NSWindow*" notifications from within my iOS app, but specifically, I get the error: "Use of undeclared identifier 'NSWindowDidEnterFullScreenNotification' when I use "[NSNotificationCenter defaultCenter] addObserver" to get notified when my app goes full screen.
Any ideas as to how I can bridge this gap between iOS and MacOS and get notifications from MacOS, without resorting to Mac Catalyst? This capability would be extremely useful.
Post not yet marked as solved
Hi, I have Mac catalyst app, that usually shows one window, but under some circumstances I open another one with different content (so it is multi-windowed app, but not in a way of opening several documents in instances of the same type of window). I did manage to setup SceneDelegate, open scenes etc., but I have still some problems.
After app launch, old scenes are automatically recreated. Is there a way to stop it? I want to always start with main scene, and only open the second one from code.
Is there a way to set size and position of a window before it is shown? I can do it by acquiring NSWindow from UIWindow and then using AppKit from another bundle. But this can only be done after the window appears on screen. As a result, user sees window "jump".
When scene is being created (or maybe just recreated to restore previous session), window gets the same position it had before. Is there any way to control it? How this mechanism exactly works? Where are the previous positions stored and can they be modified? How a newly created scene gets its size and position?
MacOS M1 machines can run iOS applications.
We have an iOS application that runs a fullscreen metal game. The game can also run across all desktop platforms via Steam. In additional to Steam, we would like to make it available through the AppStore on MacOS. We'd like to utilise our iOS builds for this so that the Apple payment (micro-transactions) and sign-in processes can be reused.
While the app runs on MacOS, it runs in a small iPad shaped window that cannot be resized. We do not want to add iPad multitasking support (portrait orientation is not viable), but would like the window on MacOS to be expandable to full screen. Currently there is an option to make it full screen, but the metal view (MTKView) delegate does not receive a drawableSizeWillChange event for this, meaning the new resolution of the window cannot be received.
Is there another method of retrieving a window size change event in this context? What is the recommended way of enabling window resizing on MacOS but not iPad for a single iOS app?
Hi,
I've assigned contextual menu to my tableview rows which seems to focus cells background with blue ring in MacCatayst.
If tableview style is Plain or Grouped, it focus ring appear as it should but in InsetGrouped type tableview, it seems to be broken.
I've tried disabling the focus with :
func tableView(_ tableView: UITableView, canFocusRowAt indexPath: IndexPath) -> Bool { return false }
And
tableView.selectionFollowsFocus = false
But no luck disabling it.
Anyone has any Idea about this behaviour ?
Post not yet marked as solved
Working on the Mac Catalyst version of an iPad app. I don't know if this is a bug, intended behavior, or a setting I am missing. But how do you change (or what value is used) the app name shown in the main menu and the About box?
For example, let's say my app's "Bundle name" in Info.plist is "MyCoolApp" and the "Bundle display name" is "My Cool App".
When the app is run on iOS, I see "My Cool App" under the icon on the home screen. Perfect. But on the Mac, the app's main menu shows "MyCoolApp". Tapping on that menu includes the "About MyCoolApp" menu. The About box also shows "MyCoolApp" under the app icon. Other standard default menus also reference "MyCoolApp".
I want all of those to show "My Cool App", not "MyCoolApp".
What needs to be changed to get the "Bundle display name" to be used?
Post not yet marked as solved
Hi!I am trying to copy an mp4 or m4v video file to the general pasteboard and then paste it into iMessage.let url = Bundle.main.url(forResource: "video", withExtension: "mp4")
let videoData = Data(contentsOf: url)
UIPasteboard.general.setData(videoData, forPasteboardType: "public.mpeg-4"I can see the video is indeed in the pasteboard but it won't copy into iMessage. This is on macOS while developing an app using Catalyst.Thanks
Post not yet marked as solved
I'm trying with the MacCatalyst app which has editor screen with UITextView.
Whenever I select some text [Attributed] & try to copy/paste ( using ctrl + c ) to another Mac app ( i.e Notes, Safari) it works well but if I try to paste it to Mail App's Composer, it doesn't work!
When selecting some text and copying, it prints this log in debug window:
Incorrect NSStringEncoding value 0x8000100 detected. Assuming NSASCIIStringEncoding. Will stop this compatibility mapping behavior in the near future.
When converting Attributed string to Data, I'm applying the Encoding options as below:
[NSAttributedString.DocumentAttributeKey: Any] = [
.documentType: NSAttributedString.DocumentType.rtfd,
.characterEncoding: String.Encoding.utf8
]
Still it doesn't seem to work. Anyone has any idea about this ?
Post not yet marked as solved
I'm trying to debug a couple of crash reports for a Mac Catalyst app and seem to be unable to symbolicate my crash reports. In the Xcode Organizer, I see unsymbolicated lines for my app, despite having the original archive for the build in question. A search for the relevant dSYM (using the process from https://developer.apple.com/documentation/xcode/adding-identifiable-symbol-names-to-a-crash-report#Locate-a-dSYM-Using-Spotlight) yields no results.
Unlike iOS builds, the "Download dSYMs" button isn't present in the organizer, nor is the option to download dSYMs from App Store Connect. I assume this is because macOS apps don't use bitcode.
The app's Debug Information Format is set to DWARF with dSYM File.
Has anyone else run into this issue? Any ideas about how I can symbolicate the crash logs?
Post not yet marked as solved
The WWDC '17 session for core spotlight said QLSupportsSearchableItems is only for "shoebox" apps and explicitly said it's not for document-based apps, but when trying to upload my UIDocumentBrowserViewController-based MacCatalyst app with a quicklook extension (the view-controller-based quicklook preview works great) to App Store connect, it prevents me from uploading without a QLSupportsSearchableItems keys in my quicklook extension's info.plist, and it prevents me from uploading it if the value is false (0).
Is the app store validator correct, and I must have this key and it must be true?
Do I have to implement func preparePreviewOfSearchableItem(identifier, and if so, can I just have it always fail?
If it can't fail, how would I get a sandbox url for the document from a searchable item identifier?
Also, Xcode won't find anything when I search for QLSupportsSearchableItems, which is not so much ironic as it is face-palmy.
Post not yet marked as solved
Hi,
I'm trying to define the style of an UIButton using UIButton.Configuration in a Mac Catalyst app.
I was able to configure the component as I want except one thing.
I want to change the style of the button when the window is not active.
The default filled style automatically do this.
For example below you can see a button configured with
UIButton.Configuration.filled().
If the window become inactive (for example by activating another application) the color of the button change, like so:
Now, If I configure a button with this configuration:
var configuration = UIButton.Configuration.plain()
configuration.background.strokeColor = .gray
configuration.baseForegroundColor = .red
configuration.baseBackgroundColor = .clear
the button display with this configuration when the window is active:
but also when it's not active:
I want to change the text color from red to gray when the window is not active.
Someone know how to do it?
Thank you
Post not yet marked as solved
Hi,
The following code allow to build an image from an UILabel:
let label = UILabel()
label.text = "test content"
label.backgroundColor = .white
label.layer.cornerRadius = 10
label.layer.masksToBounds = true
label.sizeToFit()
let format = UIGraphicsImageRendererFormat()
format.scale = 5
let renderer = UIGraphicsImageRenderer(bounds: label.bounds, format:format)
let image: UIImage? = renderer.image { rendererContext in
label.layer.render(in: rendererContext.cgContext)
}
This works perfectly on iOS but on Mac Catalyst the label text is very blurry as you can see in the image below.
Both images are created with the same exact code and have the exact same resolution of 460x103.
On top the iOS version and on bottom the Mac Catalyst version.
Note that not all of the image is blurry, but only the text. In the code I set a corner radius of 10 and you can see that the corner is rendered with an high resolution, like the iOS version. It's just the text that for some reason is blurry. It's like if the label text is rendered with a scale of 1 and then scaled up.
Someone know why? There is something I can do to improve the rendering of the text?
Thank you
Post not yet marked as solved
I get this error in Xcode 13.4. I set the deployment target to macOS 12.3 (latest available) but I still get this error.
Which version of macOS should I set as deployment target, to get rid of this error. I dont want to use 'if #available' because I have no alternative code path.
Which macOS version corresponds to Mac Catalyst 14.0?
Post not yet marked as solved
Hi, I've made a simple list using UITableview for Mac Catalyst and have set the separator style to default. ( I'm not using Diffable datasource )
The problem is it is showing separators in iPhone and iPad, but not showing in Mac.
Does any one has any idea about this behaviour? Is there any way to show for the Mac or do I have to make custom cells with separators ?
Post not yet marked as solved
We released our app 2 years ago, it is available on iPhone, iPad and macOS (with catalyst).
Since macOS Monterey, the WKWebview is crashing at random, for different customers it will be a different thing that triggers the crash. It could be a specific button or simply one text box inside a web page and it will be that specific thing all the time that will crash the app from now on. For different customers it will be a different trigger. It could be anything.
The problem is exactly the same on Intel and M1.
Only a restart (or multiple) or a shut down can resolve the problem, but not for everyone, for some people it will be one specific button on one of our 5 000 web pages that will start crashing the app and nothing will ever make it work again.
Of course I cleared the cashes programmatically, even deleted the files and uninstalled the app. The crash dump is mostly the same and in my crash log, there is not a single line of code belonging to my code. The crash is really inside the Safari engine or the WKWebview.
There are other problems with WKWebview since Monterey : Pasting text Cmd+V in web page paste the text twice and dropdown can only be used once, after that they never open again unless you click on an empty space elsewhere. This is on any web pages, not just ours.
Of course none of these problems are happening on iPhone and iPad and they use the exact same code (macCatalyst). Please Apple take the macOS seriously or discontinue the product.
Crash Dump
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: <SPRoundedWindow: 0x154e8f060>. "frame=!CGRectIsNull(frame)"'
terminating with uncaught exception of type NSException
abort() called
Application Specific Backtrace 0:
0 CoreFoundation 0x00000001c404eb08 __exceptionPreprocess + 240
1 libobjc.A.dylib 0x00000001c3d99e14 objc_exception_throw + 60
2 Foundation 0x00000001c4fc4c80 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0
3 AppKit 0x00000001c6b7fbec -[NSWindow _reallySetFrame:] + 900
4 AppKit 0x00000001c6b7f4ac -[NSWindow _oldPlaceWindow:fromServer:] + 228
5 AppKit 0x00000001c6b7e490 -[NSWindow _setFrameCommon:display:fromServer:] + 2220
6 SafariPlatformSupport 0x00000001eaf26f08 __85-[SPSafariPlatformSupport displayOTPAutoFillRelativeToRect:ofView:completionHandler:]_block_invoke + 300
Post not yet marked as solved
We have a Mac Catalyst app which uses the keychain to store secrets. We’ve received a report from a user that the app ran fine for a number of days, but has recently started failing to store OR retrieve that secret and displays an in-app alert to that effect. Top line is that both SecItemAdd and SecItemCopyMatching return errSecInteractionNotAllowed, though they have been working just fine previously.
I know that on iOS this issue can be the result of the device being locked while the app operates in the background. But the user is actively using the app when this happens (ergo the device should be unlocked). Is there something more about keychains on macOS that I’m missing? Is this something particular to Catalyst? We haven’t been able to reproduce it. Any help would be appreciated! From an actual solution to suggestions for reproducing the bug to suggestions on differences between macOS and iOS in this respect.
The secret in question is stored with the following dictionary:
let insertQuery: [String:Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecValueData as String: Data(secret.utf8), // `secret` being a String with the secret’s value
kSecAttrService as String: serviceTag, // `serviceTag` being a String with the name of the secret
kSecAttrAccessible as String: kSecAttrAccessibleWhenUnlockedThisDeviceOnly
]
let insertQueryCFValue = query as CFDictionary
let status = SecItemAdd(insertQueryCFValue, nil)
Looking up the secret goes like this:
let findQuery: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: serviceTag, // As above
kSecMatchLimit as String: kSecMatchLimitOne,
kSecReturnAttributes as String: true,
kSecReturnData as String: true
]
let findQueryCFValue = findQuery as CFDictionary
var item: CFTypeRef?
let status = SecItemCopyMatching(findQueryCFValue, &item)
In both code snippets status == errSecInteractionNotAllowed.
Post not yet marked as solved
My UIDocumentBrowserViewController-based Mac Catalyst app shows the "open window" when launched; fine. but there is also a blank document window. Once I pick a document, and present my document view controller over my UIDocumentBrowserViewController subclass, the window is filled with the documents contents. How do I get it to hide the blank window behind it?
Post not yet marked as solved
I currently have 3 different apps (one for iPhone, one for iPad and one for Mac, with different bundle ids) published in the App Store and I'm thinking of the possibility to merge them into one, and make that one Universal.
At the moment I have 3 different Xcode targets with some code shared and some unique per platform. This allows me to keep iPhone-only code on the iPhone target, and iPad only code to the iPad, for example.
My question is if I can keep this 3 different targets and create 3 different builds but somehow put them under the same app in AppStoreConnect (I don't know how to do that)?
If the answer is no, I suppose I'd have to take the iPhone app, make it universal, and update my code to use the iPad's one instead. I currently use compiler conditionals like #if IS_IPAD_APP, I wonder if I could do a similar thing to avoid compiling iPhone code or assets into the iPad?
For Mac I believe I can submit a different bundle?
Thank you in advance!