Post not yet marked as solved
Hello,
With the new App Store Connect, iOS apps become available on the new Macs with Apple Silicon natively. A couple of my apps got quite some complications with Catalyst and do not need it anymore.
I would like to know how to completely remove a platform from App Store Connect, without impacting the iOS version, so that I can let my iOS app be available on the Mac App Store instead of the Catalyst app.
Thank you
Post not yet marked as solved
New versions of AppKit/Mac Catalyst apps that use Google's Sign In framework are being rejected by App Store Review for the past two weeks.
Reason shared was:
The user is taken to the default web browser to sign in or register for an account, which provides a poor user experience.
And also citing: Data Collection & Storage guidelines -> https://developer.apple.com/app-store/review/guidelines/#data-collection-and-storage
Opening macOS' default web browser has been a native behavior of Mac apps when using SFSafariViewController with ASWebAuthenticationSession, which is required, since iOS 13, for securely/privately logging in users.
As far as I could investigate, there hasn't been any updates to the guidelines that would indicate any required changes to developers in regards to how login works for macOS apps.
Are there any steps developers need to take to get updates approved while still providing users with Google's Sign in?
As reference, there is an on-going discussion on GoogleSignIn repo about this issue affecting multiple developers and apps:
https://github.com/google/GoogleSignIn-iOS/issues/388
Post not yet marked as solved
I'm working to make my iOS app available via Catalyst, and I'm adding a leading-edge sidebar via UISplitViewController and putting a toggle button in the window toolbar to control it. I'd like that sidebar toggle button to go on the leading side of the toolbar, before the window title.
In the Adding a Toolbar Catalyst tutorial, there are screenshots of this behavior:
But when I download the finished project and run it on my machine (macOS 14.4), the toolbar buttons are clustered on the trailing edge:
How do I achieve the behavior shown in the tutorial's screenshot, where the toggle sidebar button (or, ideally any custom toolbar item I choose) shows up on the leading edge? Even more ideally, is there a way I can make the sidebar toggle button show up in the header section for the sidebar, like it does in Xcode - right next to the stoplight buttons?
Post not yet marked as solved
DemoCode:
import SwiftUI
import UIKit
import PencilKit
class PencilKitViewController: UIViewController, PKCanvasViewDelegate, PKToolPickerObserver {
lazy var canvasView: PKCanvasView = {
let canvasView = PKCanvasView()
canvasView.drawingPolicy = .anyInput
canvasView.translatesAutoresizingMaskIntoConstraints = false
return canvasView
}()
lazy var toolPicker: PKToolPicker = {
let toolPicker = PKToolPicker()
toolPicker.showsDrawingPolicyControls = true
toolPicker.addObserver(self)
return toolPicker
}()
let drawing = PKDrawing()
override func viewDidLoad() {
super.viewDidLoad()
canvasView.drawing = drawing
canvasView.delegate = self
view.addSubview(canvasView)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
canvasView.frame = view.bounds
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
toolPicker.setVisible(true, forFirstResponder: canvasView)
toolPicker.addObserver(canvasView)
canvasView.becomeFirstResponder()
}
// canvas
func canvasViewDrawingDidChange(_ canvasView: PKCanvasView) {
print("drawing")
}
func canvasViewDidFinishRendering(_ canvasView: PKCanvasView) {
}
func canvasViewDidEndUsingTool(_ canvasView: PKCanvasView) {
}
func canvasViewDidBeginUsingTool(_ canvasView: PKCanvasView) {
}
}
// UIRepresentable for SwiftUI
struct PencilKitView: UIViewControllerRepresentable {
class Coordinator {
var parentObserver: NSKeyValueObservation?
}
var onSubmit: ((UIImage?, Error?) -> Void)? = .none
func makeUIViewController(context: Context) -> PencilKitViewController {
let pencilKitViewController = PencilKitViewController()
context.coordinator.parentObserver = pencilKitViewController.observe(\.parent, changeHandler: { vc, _ in
})
return pencilKitViewController
}
func updateUIViewController(_ uiViewController: PencilKitViewController, context: Context) {
}
func makeCoordinator() -> Self.Coordinator { Coordinator() }
}
struct ContentView: View {
var onSubmit: ((UIImage?, Error?) -> Void)? = .none
var body: some View {
PencilKitView()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
iOS:
macCatalyst:
Post not yet marked as solved
extension UIView {
func takeSnapshot(rect : CGRect? = CGRect.zero) -> UIImage? {
let renderer = UIGraphicsImageRenderer(size: frame.size)
var image = renderer.image { _ in drawHierarchy(in: bounds, afterScreenUpdates: true) }
if let imageRect = rect, imageRect != CGRect.zero {
let screenshotFrame = CGRect(x: imageRect.origin.x * UIScreen.main.scale, y: imageRect.origin.y * UIScreen.main.scale, width: imageRect.size.width * UIScreen.main.scale, height: imageRect.size.height * UIScreen.main.scale)
let imageRef = image.cgImage!.cropping(to: screenshotFrame)
image = UIImage.init(cgImage: imageRef!, scale: image.scale, orientation: image.imageOrientation)
}
UIGraphicsEndImageContext()
return image
}
}
which was working fine until I updated to macOS 14.4.1 from 14.2.1 and to Xcode 15.3 from 15.0.
issue
From my Mac Catalyst app, if I try to take screenshot of imageView, the screenshot is brighter.
If I try this method it seems working:
func takeSnapshotWithoutScale() -> UIImage? {
UIGraphicsBeginImageContextWithOptions(self.frame.size, false, 0)
if let currentContext = UIGraphicsGetCurrentContext() {
self.layer.render(in: currentContext)
}
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage
}
Post not yet marked as solved
I am really stuck. I uploaded my Mac Catalyst app. The binary passes validation beforehand. I submit for review. After being in "waiting for review" for a couple of minutes it is rejected with "invalid binary" and comes back with an email saying
"ITMS-90053: This bundle is invalid - The bundle identifier is already in use by a different software package."
The only app that is using the same bundle is the IOS version where I added the Mac platform.
Post not yet marked as solved
My app uses CGEventTapCreateForPid to monitor keyboard events of a corresponding process. My app has already enabled the Accessibility permission, and AXIsProcessTrustedWithOptions returns true. However, CGEventTapCreateForPid returns null. What could be the problem? Does anyone know? I tested and found that if CGEventTapCreateForPid returns null, I can reset the Accessibility permission using tccutil reset Accessibility myapp_bundleid without restarting my app. But my app can still get the permission through AXIsProcessTrustedWithOptions
Post not yet marked as solved
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?
Post not yet marked as solved
I'm trying to create a dynamic menu on Mac Catalyst. Using a UIBarButtonitem like so to make a "pull down" button:
UIDeferredMenuElement *deferredmenuElement;
deferredmenuElement = [UIDeferredMenuElement elementWithUncachedProvider:^(void (^ _Nonnull completion)(NSArray<UIMenuElement *> * _Nonnull))
{
UIAction *actionOne = [UIAction actionWithTitle:@"Action One" image:nil identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
NSLog(@"action one fired.");
}];
UIAction *actionTwo = [UIAction actionWithTitle:@"Action Two" image:nil identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
NSLog(@"action two fired.");
}];
UIAction *actionThree = [UIAction actionWithTitle:@"Action Three" image:nil identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
NSLog(@"action three fired.");
}];
completion(@[actionOne,actionTwo,actionThree]);
}];
UIMenu *wrappedMenu = [UIMenu menuWithChildren:@[deferredmenuElement]];
UIBarButtonItem *uiBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:nil
menu:wrappedMenu];
uiBarButtonItem.image = [UIImage systemImageNamed:@"rectangle.and.pencil.and.ellipsis"];
self.navigationItem.rightBarButtonItems = @[uiBarButtonItem];
The button appears in the toolbar but when I click it to expose the menu I get a menu with on element in it that says "Loading...". The the uncached provider block is never called.
Running Ventura 13.2.1 and Xcode 14.2.
Hey, I am trying to use Family Controls in Mac Catalyst. On the iOS app it works fine. On macOs using Mac Catalyst it builds fine but I get following console output.
Failed to get service proxy: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction.}`
When i try to open the FamilyActivityPicker on the macOs app following error is displayed in the GUI.
The operation could not be completed. (FamilyControls.ActivityPickerRemoteView Error error 2.)
Do I need a familyControls capability for macOs? If yes, I only find it for iOS.
Thanks for hints and help :)
Post not yet marked as solved
Starting with the macOS version 14.x.x and TextKit1, selecting multiple lines of text triggers a text replacement bug: some of the text on one of the selected lines inadvertently replaces a portion of the selected text.
For example, the bug is exhibited when selecting the following lines:
Carnaroli, Maratelli, or Vialone Nano are best
Vialone Nano cooks quickly – watch it! It also absorbs condiments nicely.
Avoid Baldo, Originario, Ribe and Roma
To trigger the bug, select the three line paragraph using either the cursor or shift with arrow keys. Notice that a portion of the selected text was replaced. Command-Z to undo will allow you to repeat the undesired behavior.
In this case, "e Nano cooks quickly - " is replaced by "Baldo, Originario, Ribe."
This does not occur with all strings or selected strings, but in cases where it does occur, it is perfectly reproducible. It does not occur on iOS. Pasteboard contents are irrelevant. After triggering the bug repeatedly, at some point it stops occurring.
Why does this bug occur? How can it be fixed?
Here is some sample code to reproduce the issue.
@end
@implementation TestNoteViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self createTextView];
}
- (void)createTextView {
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:self.note.text
attributes:nil];
NSTextStorage *textStorage = [NSTextStorage new];
[textStorage appendAttributedString:attrString];
CGRect newTextViewRect = self.view.bounds;
// Create the layout manager
NSLayoutManager *layoutManager = [NSLayoutManager new];
[textStorage addLayoutManager:layoutManager];
// Create a text container
NSTextContainer *container = [[NSTextContainer alloc] initWithSize:CGSizeMake(newTextViewRect.size.width, CGFLOAT_MAX)];
[layoutManager addTextContainer:container];
// Create and place a text view
UITextView *textView = [[UITextView alloc] initWithFrame:newTextViewRect
textContainer:container];
[self.view addSubview:textView];
textView.translatesAutoresizingMaskIntoConstraints = NO;
UILayoutGuide *safeArea = textView.superview.safeAreaLayoutGuide;
[textView.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor].active = YES;
[textView.trailingAnchor constraintEqualToAnchor:safeArea.trailingAnchor].active = YES;
[textView.topAnchor constraintEqualToAnchor:safeArea.topAnchor].active = YES;
[textView.bottomAnchor constraintEqualToAnchor:textView.superview.bottomAnchor].active = YES;
}
@end
Post not yet marked as solved
I recently updated to macOS Sonoma 14.4 and now UIDevice.current.batteryLevel is always 0.
Code to reproduce:
import SwiftUI
struct ContentView: View {
@State
private var monitoringEnabled = UIDevice.current.isBatteryMonitoringEnabled;
@State
private var batteryLevel = UIDevice.current.batteryLevel;
var body: some View {
VStack {
Text("Battery Monitoring Enabled: " + String(monitoringEnabled))
Text("Battery Level: " + String(batteryLevel))
Button("Toggle Monitoring") {
monitoringEnabled = !monitoringEnabled;
UIDevice.current.isBatteryMonitoringEnabled = monitoringEnabled;
batteryLevel = UIDevice.current.batteryLevel;
}
}
.padding()
}
}
Run the above on a macOS 14.4 target, click "Toggle Monitoring", and you'll see battery level is reported as 0:
I also see the following error in my app logs when running on macOS 14.4:
Error retrieving battery status: result=-536870207 percent=0 hasExternalConnected=1 isCharging=0 isFullyCharged=0
This code displays the expected battery level when running on an actual iOS device:
Post not yet marked as solved
For some reason, I have to build my iOS app project on target My Mac(Designed for iPhone) instead of using Mac Catalyst.
Now I want to access these window buttons, is there any possible way to do that? or print current view/components whatever it is while clicking button?
Post not yet marked as solved
Hello,
in my Mac Catalyst app, I have detail view with sections modeled as DisclosureGroups. The label view has a button, that shall trigger a file import view when pushed. The label view is defined as follows:
swift
HStack {
Text(LocalizedStringKey("Documents")).font(.title)
Spacer()
Button {
showFileImporter = false
// fix broken picker sheet
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
showFileImporter = true
}
} label: {
Image(systemName: "doc.badge.plus")
.padding(.horizontal, 10)
}
.disabled(!expanded)
.fileImporter(
isPresented: $showFileImporter,
allowedContentTypes: [.data],
allowsMultipleSelection: false) { result in
// add fileUrl.startAccessingSecurityScopedResource() before accessing file
NSLog("\(result)")
}
}
Unfortunately the file import view is not showing, when the button is pushed, although the state changes to true.
Does anybody have any hints?
BTW the repo is available at https://github.com/thbonk/repti/tree/ui-refactoring
The view in question is https://github.com/thbonk/repti/blob/ui-refactoring/Repti/Source/UI/Views/IndividualDetails/DocumentsSubview.swift
Thanks & Best regards
Thomas
I have an iOS app that uses os_signpost API for instrumentation.
When I profile it from Xcode on real iOS device, it works as expected.
When I profile its macCatalyst variant (using the identical code) on the same Mac where Xcode is running, the os_signpost Instrument does not show anything, not even the Apple provided signposts that are otherwise visible on the iOS.
How do I make it work?
Post not yet marked as solved
In Xcode 15 beta 6, building any Mac Catalyst project will encounter the following Linker warning.
ld: warning: building for 'macCatalyst', but linking in dylib (/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa.tbd) built for 'macOS'
Post not yet marked as solved
Hello,
We've an iOS application that can be launched on macOS (with the "designed for iPhone" available with Catalyst).
This application request authorization on MPMediaLibrary and play MPMediaItem with an audio player. After accepted, the authorization status is well flagged as .authorized
I can browse all MPMediaItem without issue and display them in my app.
But, when it comes the time to convert the MPMediaItem file's URL in AVAudioFile with:
AVAudioFile(forReading: fileURL)
We got 2 warnings in the console:
ExtAudioFile.cpp:211 about to throw -54: open audio file
AVAEInternal.h:109 [AVAudioFile.mm:135:AVAudioFileImpl: (ExtAudioFileOpenURL((CFURLRef)fileURL, &_extAudioFile)): error -54
We finally get an exception with this error:
Error Domain=com.apple.coreaudio.avfaudio Code=-54 "(null)" UserInfo={failed call=ExtAudioFileOpenURL((CFURLRef)fileURL, &_extAudioFile)}
This working perfectly on iOS and iPadOS, but with Catalyst we always got this error whatever the audio (from iTunes library) we try to play.
Why do we have this permission issue only on macOS ? There is something different to do to get permission on macOS ?
thanks !
Post not yet marked as solved
I am adding Group Activities integration with a MacCatalyst app. I have added the Group Activities entitlement in Xcode. I also checked the entitlements with :
codesign --display --entitlements :-
I can see the entitlement :
<key>com.apple.developer.group-session</key><true/><key>
The feature work fine on iPadOS but when I run it on MacOS, the GroupActivitySharingController is not loading properly. I get the following error messages:
Cannot run query EXQuery: extension point com.apple.groupactivities platforms: 6 with error: (null)
Failed to lookup extension with query EXQuery: extension point com.apple.groupactivities platforms: 6 on <_GroupActivities_UIKit.PeoplePickerController: 0x600005020980>
Failed to fetch config for hostViewController <_GroupActivities_UIKit.PeoplePickerController: 0x600005020980>
Failed to build remote hostViewController for <_GroupActivities_UIKit.GroupActivitySharingController: 0x1417f1250>
Failed to fetch extensionViewController
Calling -viewDidAppear: directly on a view controller is not supported, and may result in out-of-order callbacks and other inconsistent behavior. Use the -beginAppearanceTransition:animated: and -endAppearanceTransition APIs on UIViewController to manually drive appearance callbacks instead. Make a symbolic breakpoint at UIViewControllerAlertForAppearanceCallbackMisuse to catch this in the debugger. View controller: <_GroupActivities_UIKit.GroupActivitySharingController: 0x1417f1250>
I got a similar error on iPadOS when the entitlement was not added. Now that I have the entitlement, the error appears only on MacOS.
Does MacOS/MacCatalyst use a different entitlements file? What could be cuasing this?
Post not yet marked as solved
Preparing an iPad App for native MacOS experience using Mac Catalyst (and AppKit when needed) and using SwiftUI.
We observe that Horizontal Scroll is tricky using a Mouse! Most users have the habit of click+drag to scroll horizontally. This does not seem to be default behavior on ScrollView.
Strange: Same App when compiled on "Mac (Designed for iPad)" [aka Silicon only] scrolls horizontally with click drag. But not if compiled with Mac Catalyst.
Question: How can we enable general click-drag for horizontal scrolling using SwiftUI on Mac Catalyst? I wouldn't mind using specific AppKit framework if needed.
Thanks in advance.
Post not yet marked as solved
Hi,
I have an imagePickerController where .allowsEditing is set to true after picking an image. I can move/scale it in iPhone/iPad simulators, but running on my Mac the scaling part of it doesn't work and I don't know how I could go about making the scaling work. Any suggestions much appreciated.
Update: I am using a Magic Mouse. No Trackpad or Touchscreeen Mac.