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

147 Posts
Sort by:
Post not yet marked as solved
1 Replies
353 Views
Mac Catalyst treats a SwiiftUI .sheet View as compact, even though there is as much horizontal space in the view as on a physical iPad. The outcome of this is that, with an iPhone, iPad, Catalyst app, abbreviated HStacks that I use for the iPhone version also appear on the Catalyst version, unless I use #if targetEnvironment(macCatalyst) A few months back a Stack Overflow user complained that a Catalyst popover (UIKit) was reporting as .regular and should be .compact. Apple agreed it was a bug. However, in my case (SwiftUI sheet), it doesn't make sense to regard a Catalyst SwiftUI sheet as compact when there is as much space available as on a physical iPad. Regards to all, Michaela
Posted Last updated
.
Post not yet marked as solved
0 Replies
64 Views
I have a SwiftUI app where I can sign in via Apple Sign In using Firebase Auth. This works completely fine on iPad and iPhone. However when when running the app via catalyst on Mac, using Apple Sign In I get a crash with the following log. _AuthenticationServices_SwiftUI/SignInWithAppleButton.swift:303: Fatal error: Attempting to present ASAuthorizationController from a SwiftUI view not in a hierarchy. This should not be possible, please file feedback. 2022-07-13 19:31:29.368989+0100 appname[93200:13915263] _AuthenticationServices_SwiftUI/SignInWithAppleButton.swift:303: Fatal error: Attempting to present ASAuthorizationController from a SwiftUI view not in a hierarchy. This should not be possible, please file feedback. (lldb) I am not sure what is wrong, I have checked Apple Documentation and am struggling to find a fix. Apple Sign In Object: import SwiftUI import AuthenticationServices import CryptoKit @EnvironmentObject var store: Store struct SignInWithAppleButtonView: View { //Hashing function using CryptoKit private func sha256(_ input: String) -> String { let inputData = Data(input.utf8) let hashedData = SHA256.hash(data: inputData) let hashString = hashedData.compactMap { return String(format: "%02x", $0) }.joined() return hashString } // from https://firebase.google.com/docs/auth/ios/apple private func randomNonceString(length: Int = 32) -> String { precondition(length > 0) let charset: Array<Character> = Array("0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._") var result = "" var remainingLength = length while remainingLength > 0 { let randoms: [UInt8] = (0 ..< 16).map { _ in var random: UInt8 = 0 let errorCode = SecRandomCopyBytes(kSecRandomDefault, 1, &random) if errorCode != errSecSuccess { fatalError("Unable to generate nonce. SecRandomCopyBytes failed with OSStatus \(errorCode)") } return random } randoms.forEach { random in if remainingLength == 0 { return } if random < charset.count { result.append(charset[Int(random)]) remainingLength -= 1 } } } return result } @State var currentNonce:String? var body: some View { SignInWithAppleButton(.signIn) { request in // You can change them if needed. let nonce = randomNonceString() currentNonce = nonce request.requestedScopes = [.fullName, .email] request.nonce = sha256(nonce) } onCompletion: { result in // Switch result switch result { // Auth Success case .success(let authResults): default: break } case .failure(let error): print("failure", error) } } .frame(maxWidth: .infinity) } Login import SwiftUI import AuthenticationServices import CryptoKit struct login: View { @EnvironmentObject var store: Store var body: some View { GeometryReader { geometry in ZStack(alignment: .bottom) { VStack(alignment: .center, spacing: 20) { SignInWithAppleButtonView() .signInWithAppleButtonStyle(.black) .environmentObject(store) } } } } } Handler class Store : ObservableObject { func signInWithAppleHandler(credential: OAuthCredential) { Auth.auth().signIn(with: credential) { (authResult, error) in if (error != nil) { // Error. If error.code == .MissingOrInvalidNonce, make sure // you're sending the SHA256-hashed nonce as a hex string with // your request to Apple. print(error?.localizedDescription as Any) return } print("Signed in") if let user = authResult?.user { // Fetch profile let db = Firestore.firestore() db.collection("users").document(user.uid).getDocument { [self] (document, error) in if let document = document, document.exists { //User exists now save that to current user _ = document.data().map(String.init(describing:)) ?? "nil" do { self.profile = try document.data(as: Profile.self) } catch { print("There was an error getting decoding Profile") } if self.profile != nil { self.userAuthState = .signedIn self.isNewUser = self.profile!.newUser self.loadProfileImageFromFirebase(uid: profile!.uid) } } else { // create profile firestoreManager.createProfile(uid: user.uid, email: user.email ?? "") fetchProfile(uid: user.uid) } } } } } } Apple Documentation: https://developer.apple.com/documentation/authenticationservices/signinwithapplebutton Firebase Documentation: https://firebase.google.com/docs/auth/ios/apple
Posted
by RileyDev.
Last updated
.
Post not yet marked as solved
1 Replies
145 Views
UITextview's Spellchecker seem not to detect spells and show red dots at odd position in MacCatalyst: It does work well in iPhone and iPad though. I've activated the Spellcheck through storyboard, also tested with both Normal and Attributed strings. Even tried disabling the scrolling. But nothing seems to help! Does any one know about this behaviour?
Posted Last updated
.
Post not yet marked as solved
1 Replies
108 Views
Hello there, Does the UNNavigationController have to be the rootViewController to get the automatic conversion to an NSToolBar? For example, I have a UITabBarController which contain several views, each with their own UINavigationController but they are not converting to NSToolBars. Is this a beta 2 limitation? Also, the sample code linked for session wwdc2022-10076 won’t compile for macOS vis Catalyst. https://developer.apple.com/documentation/uikit/app_and_environment/supporting_desktop-class_features_in_your_ipad_app Thanks, Matt
Posted Last updated
.
Post not yet marked as solved
0 Replies
87 Views
I built a MacOs app, and it works fine, but the problem happens when I achieve the project. When I tried from an old Xcode version (12.3) Macbook Pro late 13 it works But when I run from Macbook pro-2020 (M1 chip), the issue happened while archiving, and works fine while running, I use Xcode 14 beta. The app is written in objective-c I get this error: /Users/usamafouad/Downloads/Oil Paint - Mac/Oil Paint App/frameworks/Source/Mac/GPUImageMac-Prefix.pch error build: Build input file cannot be found: '/Users/usamafouad/Library/Developer/Xcode/DerivedData/Oil_Paint-dywawlmfpsulhqapvsuiigxhgkrs/Build/Intermediates.noindex/ArchiveIntermediates/Oil Paint/InstallationBuildProductsLocation/@loader_path/../Frameworks/GPUImage.framework/Versions/A/Modules/module.modulemap' Could you please help me, it's an urgent issue?
Posted
by osos.
Last updated
.
Post not yet marked as solved
0 Replies
101 Views
When I hover the mouse over the NSTextAttachment image inside the UITextview, it should show this option to MarkUp. All native app including Notes, TextEditor, Mail have this behaviour: I think, by default, NSTextView will show the NSSharingServicePicker button when you hover over an image inside the text view. That’s true even for custom image-based NSTextAttachments in the attributed string. But it is not showing the button for UITextview in MacCatalyst. Also NSSharingService class is limited to MacOS only. Are there any alternative way to achieve this in MacCatalyst?
Posted Last updated
.
Post marked as solved
5 Replies
5k Views
I'm trying to build my iOS app to macOS Catalyst. Everything works fine when running locally on my machine via Xcode, but an error occurs when I archive and try to upload to the notarisation service: Cannot create a Mac Catalyst Developer ID provisioning profile for "br.com.marcosatanaka.music-harbor". The App Groups capability is not available for Mac Catalyst Developer ID provisioning profiles. Disable this feature and try again. I have the App Groups capability enabled on my app's target Signing &amp; Capabilities tab on Xcode. But, when I go to the Apple Developer portal under Certificates, Identifiers &amp; Profiles > Profiles and select the Mac Catalyst provisioning profile (automatically generated by Xcode), the App Groups capability is not present on the Enabled Capabilities section. I can work around this issue by removing the com.apple.security.application-groups entitlement when building for Mac Catalyst, but that causes me a runtime error when Core Data tries to access the store located on the shared container. I also need it to be on a shared container because I want to access the database from both the main app and also the new widget extension. How can I add the App Groups capability to my Mac Catalyst provisioning profile?
Posted Last updated
.
Post not yet marked as solved
1 Replies
153 Views
I am building an iOS / Swift app for my M1 Mac in XCode by selecting the build target of "My Mac (designed for iPad)" from the drop down list. I was wondering if it is possible to access local files on my mac ( e.g. /Users/Downloads etc ) via the usual FileManager APIs ( or any other way ) I'm NOT trying to access files in the app bundle or app documents directory. I get a permissions error when trying to read a file or directory. I'm pretty sure I had done this in the simulator before, but that approach won't work here because I use some pre-compiled arm64 only libraries. I also tried Mac Catalyst but had similar build issues around my pre-compiled libraries. Maybe there is a way to use arm64 simulator on the M1? Thanks
Posted
by cc4.
Last updated
.
Post not yet marked as solved
1 Replies
126 Views
I'd like to handle it so that it doesn't quit even if I press the Dock Icon's "Quit menu" on Mac Catalyst. Please let me know how to use the delegate func below on Mac Catalyst. func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply
Posted
by debugmark.
Last updated
.
Post marked as solved
2 Replies
538 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
1 Replies
164 Views
We are building an app that support Mac Catalyst and network extension is included in. We don't know why the compiler throw this error: Network extensions are not available when building for Mac Catalyst. The documentation related to network extensions (in this case NEFilterDataProvider) in apple docs said explicitly that Mac catalyst is available. @eskimo @meaton please let me know if there's a bug with it. https://developer.apple.com/documentation/networkextension/nefilterdataprovider
Posted
by JesusMG.
Last updated
.
Post marked as solved
2 Replies
225 Views
I have 2 Apps. A sandboxed native Mac App written in AppKit/SwiftUI. A Catalyst App. I would like them to be able to communicate with each other. I assumed I would be able to do this using a shared App Group but I can't get it to work and I think this is because the App Group naming conventions appear to be different. As far as I can make out: A Mac App uses App groups prefixed with the team ID A Catalyst App uses the iOS App groups which are prefixed with group. I have tried multiple combinations of different prefixes to try and make this work but without success. I have been "testing" this by using UserDefaults(suiteName: appGroup) and then attempting to read write values between the 2 Apps but without success so far. My questions are: Is sharing an App Group between Catalyst and native technically possible? If it is possible what is the magic combo of App Group prefixes that makes it work? If it is not possible then do I have any other options for communicating between a sandboxed Mac App and a Catalyst App?
Posted Last updated
.
Post not yet marked as solved
0 Replies
164 Views
Issue After an Update to 12.4 my AVCapture session is using between 70-90% CPU That code is just a simple capture session in a Mac Catalyst App with the webcam of the Mac. The session calls an empty func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) and nothing more is happing in the test app I tried. Also no rendering of the stream. My test code ran with 10-15% CPU usage a week ago, before I made an update today to macOS 12.4 - with rendering into a Metal view maybe 20-25% To reproduce: take AVCam project https://developer.apple.com/documentation/avfoundation/capture_setup/avcam_building_a_camera_app Set checkbox for Mac Catalyst Support in General run on Mac The original sample code from Apple is also running with the same high CPU usage. But even my AVCaptureSession code ran a week ago at about 15% which might even be too much. I have tested this on a 2019 Intel MacBook pro and also tried it on a macOS 12.4 iMac which did result in the same high CPU usage with all the test apps. Update to macOS 12.5 Beta 3 did also not help. But I know it ran better with macOS <12.4 and also almost 100% CPU even with 800% overall available is too much for just camera capture Profiling in Instruments Insturments is showing me with the heaviest stack trace a lot VN calls with object detection - is this the camera autofocusing? Do I need to put more options for the capture device? I don't call anything from the Vision Framework - is this happening automatically? It looks like this, feels like a lot of work for just the Mac webcam: what to do? Is this a problem with macOS 12.4? Do you have a better running Capture session on 12.4 and what is needed to archive that? Could this be a Catalyst problem? Is this a bug which needs a bug report with Apple? I can't really go back to a previous version, and it would be neat if the code would also work on macOS 12.4 haha
Posted
by bennibeef.
Last updated
.
Post not yet marked as solved
1 Replies
546 Views
Hi everyone, I'm build an App with Catalyst for Mac, iPhone and iPad. I've configured Apple Pay and on iPhone and iPad works fine. The problem is on the Mac, case when I call the func to check if the device canMakePayments(usingNetworks:) (with Stripe API) it always returns false and the payment sheet is not display. If I check only canMakePayment() it returns true. I'm trying on a MacBook Pro M1, so there is the compatibility with Apple Pay. I've a card on my Wallet Have you some solutions?
Posted
by fabio97.
Last updated
.
Post not yet marked as solved
17 Replies
1.6k Views
We have several Mac Catalyst apps that use UIPrintInfo and UIPrintInteractionController to support printing. Both of these classes are marked as available on Mac Catalyst 13.1 in the documentation and we do not receive any errors or warnings using them in our app. We have successfully uploaded to App Store Connect recently with apps that use those classes, but now are receiving error messages from App Store Connect complaining that the use of these classes is non-public API and receive the ITMS-90338 error, even though no code has changed. Is this an issue on the validation side, or are these classes no longer supported on Mac Catalyst? Thanks in advance for any help!
Posted
by Triglyph.
Last updated
.
Post not yet marked as solved
0 Replies
135 Views
With a simple SwiftUI layout that presents a list of tasks that can present a detail view, there appears to be no way to configure the toolbar when running on Mac Catalyst. Presenting in a NavigationView with columns gives the sidebar a toolbar that can be configured but the detail view will not have one and there is no way to add one. It will, instead, default to using iPad style toolbars which are inappropriate for macOS. .windowToolbarStyle is unavailable to Catalyst apps. Will this be addressed in macOS 13/iOS 16?
Posted Last updated
.
Post not yet marked as solved
11 Replies
3.1k Views
Running macOS 11.0.1 (20B29) with Xcode 12.2 (12B45b), with a brand new Xcode project configured as follows File -> New Project -> iOS -> App Interface: SwiftUI Lifecycle: UIKit App Delegate Language: Swift Uncheck all checkboxes In xcodeproj target, select Mac checkbox Run app on Mac I get the following errors 2020-11-26 21:24:42.940494+0000 Test[85254:1719377] [UIFocus] Focus system disabled 2020-11-26 21:24:43.029918+0000 Test[85254:1719377] [UIFocus] Focus system enabled 2020-11-26 21:24:43.606709+0000 Test[85254:1719377] [UIFocus] Focus system disabled In my actual app, I get a lot more of these - certain interactions like opening a popover can trigger them. If the last message was Focus system enabled, stuff works fine. If the last is Focus system disabled, a load of elements like Toggle and Slider aren't clickable. I couldn't figure out how to get it to end on an enabled state. I also tested this on my DTK and get the same errors on the 11.1 Big Sur beta with 12.3 Xcode beta.
Posted Last updated
.
Post not yet marked as solved
7 Replies
2.2k Views
I have an iOS app which I'm trying to build with mac Catalyst. It works well locally but I'm having problems when I try and build a notarized version to send to testers. I have sucessfully notarized the app but when I run it, nothing happens. Console logs this:default 10:10:46.455899+0000 taskgated-helper 70673: 0xdfd172 Checking profile: XC OSX: com.hacknicity.adaptivity.aerror 10:10:46.455919+0000 taskgated-helper 70673: 0xdfd172 com.hacknicity.adaptivity.a: Unsatisfied entitlements: com.apple.developer.user-fontserror 10:10:46.455934+0000 taskgated-helper 70673: 0xdfd172 Disallowing: com.hacknicity.adaptivity.adefault 10:10:46.456962+0000 amfid 184: 0xdfd304 /Users/geoff/Desktop/Adaptivity.app/Contents/MacOS/AdaptivityA signature not valid: -67671default 10:10:46.457021+0000 kernel 0: 0xdfd3ce proc 70702: load code signature error 4 for file "AdaptivityA"default 10:10:46.457380+0000 kernel 0: 0xdfd3cf Security policy would not allow process: 70702, /Users/geoff/Desktop/Adaptivity.app/Contents/MacOS/AdaptivityAdefault 10:10:46.465528+0000 ReportCrash 530: 0xdfce46 Parsing corpse data for process AdaptivityA [pid 70702]default 10:10:47.329601+0000 ReportCrash 530: 0xdfce46 Saved crash report for AdaptivityA[70702] version ??? to AdaptivityA_2020-02-25-101047_Villanelle-2.crashThe iOS app has the Fonts-&gt;Use Installed Fonts capability configured in Xcode and I use UIFontPickerViewController to allow the user to choose a custom font. That view controller simply doesn't appear on Mac Catalyst, so I conditionally removed that part of the UI. However, the entitlements are shared between the iOS and Catalyst versions so I can't have it enabled in one and not in the other.I suspect I might need to switch to manual signing so I can use separate provisioning profiles for the iOS and Catalyst versions. That seems like it shouldn't be necessary...
Posted Last updated
.
Post not yet marked as solved
1 Replies
485 Views
We have a need for continuous background processing as we are a network listener observing the state of many local network items that have no understanding of anything like push notifications, etc.On iOS this can be solved via Guided Access, thus forcing foreground access on a permanent basis. In our case, users are perfectly fine with that as they purchase the Apple devices specifically for this software.On Catalyst, there is no Guided Access. I had assumed this would be trivial because Cocoa doesn't stop execution for background apps, but Catalyst appears to simulate iOS by trying to stop any app not in the foreground even when the machine does not even have a battery (eg. iMac) and the concept of background tasks framework to save battery makes no sense, and it does so pretty quickly (30 seconds - 3 minutes).In reviewing the new background APIs, all of it seems to ignore these use cases. My real question as per the title is "how do I get continuous background processing time on Catalyst?" As I have asked that fruitlessly for a decade on iOS, in this case I will modify the need to be more realistic, "given reality that Apple does not (yet) recognize network listeners as a valid background activity, what background behavior can I use on Catalyst to ensure as close to permanent background execution as possible?"Note that, while we require continuous background execution, our actual CPU time is essentially zero. We just listen for specific network activity and take actions based on it. So I'm trying to figure out the best heuristic to get the longest lasting execution time, specifically on Catalyst. Thanks for any advice!
Posted
by cypher.
Last updated
.