Post

Replies

Boosts

Views

Activity

How to get UIFont to respect preferredContentSizeCategory in a Mac Catalyst app?
I have an iOS app that relies on dynamic text size such that all fonts in the app respect the user's setting of Text Size in the iOS Settings app. This app also runs on macOS via Mac Catalyst. But until macOS 14 Sonoma, there was no Text Size setting in the macOS Settings app. But even as of Sonoma, the Text Size setting isn't usable by 3rd party apps. And Sequoia doesn't seem to change that. As a work around, my Mac Catalyst app provides its own Text Size setting. I was able to make it work by providing my own UIApplication subclass and overriding preferredContentSizeCategory. Under macOS 12 to macOS 14, this workaround works just fine and all fonts in the app created with code such as UIFont.preferredFont(forTextStyle:) gives appropriately sized fonts based on the overridden content size category. However, this workaround stopped working with macOS 15 Sequoia. I've also tried code such as: self.window.traitOverrides.preferredContentSizeCategory = myCustomSizeCategoryValue and self.window.maximumContentSizeCategory = myCustomSizeCategoryValue self.window.minimumContentSizeCategory = myCustomSizeCategoryValue in the scene delegate but that made no difference. Is there any way to get code such as UIFont.preferredFont(forTextStyle:) to return an appropriately sized font based on some app provided content size category in a Mac Catalyst app running under macOS 15? It sure would be nice if Mac Catalyst apps automatically responded to the macOS Text Size setting under Settings -> Accessibility -> Display -> Text Size just like a native iOS app.
2
0
374
Oct ’24
How do you get the cursor to appear programmatically in a custom UITextInput with UITextInteraction?
I have created a custom input field by conforming to UITextInput. It is setup to use UITextInteraction. Everything works very well. If the user taps on the custom field, the cursor (provided by UITextInteraction) appears. The user can type, select, move the cursor, etc. But I'm stumped trying to get the cursor to appear automatically. With a normal UITextField or UITextView you simply call becomeFirstResponder(). But doing that with my custom UITextInput does not result in the cursor appearing. It only appears if the user taps on the custom field. I don't know what I'm missing. I don't see any API in UITextInteraction that can be called to say "activate the cursor layer". Does anyone know what steps are required with a custom UITextInput using UITextInteraction to activate the cursor programmatically without the user needing to tap on the custom field?
4
0
1.1k
Apr ’24
How is receipt validation supposed to work for a new Mac version of an old iOS app?
Background: I've had an app in the iOS app store for many years. Quite recently I published a Mac version of the app. The Mac version uses the same bundle id and the app is setup in App Store Connect to be the same app. It's my understanding that with this setup, if a user purchases the iOS version, they don't need to pay for the macOS version (or vice versa). The iOS app started out as a paid app and was later transitioned to a free app with in-app purchases. The new macOS version also supports the same IAPs. If it makes a difference, the macOS version is built from the iOS code base using Mac Catalyst. The app uses old StoreKit1 on-device receipt validation. Issue: I have a longtime user of the iOS app that has recently installed the macOS version. Their attempt to restore purchases in the macOS version is not resulting in anything being restored. The user originally purchased the old iOS version before it had any in-app purchases. I log diagnostic info in the app and the user sent me those logs. One of the things I show in the log is information from the receipt. The on-device receipt validation my app does is indicating it is a valid receipt. The problem is that the receipt states the original version of the app corresponds to the new macOS build. i would expect the receipt to show the version originally purchased years ago on iOS. Question: What is supposed to happen in a case like this? When the macOS version of the app requests (and gets) an updated receipt, is the receipt supposed to show the original version as the first macOS version of the app or is it supposed to show the first downloaded version, regardless of OS? What is the correct logic for restoring purchases if the macOS receipt has no indication of the user ever having used the iOS version for years?
3
0
921
Jun ’23
Why aren't new builds sent to App Store Connect reflecting my updated Info.plist?
I have a brand new macOS app (built with Mac Catalyst and based on a long existing iOS app) I've submitted to App Store Connect for review. It was rejected due to my Contacts purpose string not being deemed sufficient (despite being the same one the iOS version of the app has been using for years). Anyway, I made a change to the privacy string and submitted a new build. The new build was rejected and a screenshot showed the About screen with the new build number as well as the privacy string from the original build, not the new build. So I verified that my archive did in fact have an Info.plist with the updated privacy string. So I resubmitted that build again for review and it was rejected again for the same reason. Despite the reviewer claiming, at my request, that a fresh install of the latest build was used. So I changed the privacy string again and submitted a 3rd new build, again verifying the archive that I was sending through the Xcode Organizer did have the updated (now 3rd) privacy string. And again the app has been rejected. Despite 2 new builds, the reviewers are still seeing the original privacy string. Does anyone have any ideas on how to get this resolved?
1
0
1.1k
Jun ’23
"Import from iPhone or iPad" in UITextView context menu under Mac Catalyst
While working on the Mac Catalyst version of my iOS app, I noticed something interesting. I have a UITextView with the allowsEditingTextAttributes property enabled. When running the app on a Mac, the context menu that appears when right-clicking inside the UITextField includes the menu item "Import from iPhone or iPad". That brings up a menu with 3 options each for my iPhone and iPad that I happen to connected to my Mac recently. There options include "Take Photo", "Scan Documents", and "Add Sketch". I created a brand new iOS app project and simply added a UITextView to the main view controller. After setting allowsEditingTextAttributes to true, it shows the same behavior. Some questions: Is this documented anywhere? I'm guessing this is related to Continuity Camera in some way. But there's no mention of this anywhere that I've seen so far. How can I prevent this menu from appearing? Nothing related to these menus comes through the canPerformAction(_:withSender:) method. And nothing related to these menus is part of the menu item array sent to the UITextViewDelegate textView(_:editMenuForTextIn:suggestedActions:) method. I need to remove this menu in my app because while I support some text attributes (bold, italic, underline), I do not want to allow pictures to be added. Does anything else in iOS under Mac Catalyst automatically get similar support? If so, what?
3
0
1.2k
May ’23
How do I support macOS 12.6 with a Mac Catalyst app and Xcode 14.2?
I have an Intel Mac running macOS Monterey 12.6. I'm running Xcode 14.2. I created a new iOS project. I deleted the "Mac (Designed for iPad)" destination and added the "Mac (Mac Catalyst)" destination. Unlike the iOS minimum deployment target, oddly there is no place to set the macOS minimum deployment target. I had to go to the target's Build Settings and change it there. I then chose "My Mac (Mac Catalyst)" as the build target and built the project. So far, so good. I then tried to run the app. I get a dialog with the following message: Could not launch “SampleApp” The app is incompatible with the current version of macOS. Please check the app's deployment target. Clicking on the Details button gives lots of info. Some things I see are: ... "device_osBuild" = "12.6 (21G115)"; ... "sdk_canonicalName" = "macosx13.1"; "sdk_osVersion" = "13.1"; But I'm not running macOS 13.1. I have macOS 12.6. Oddly there's no mention of the deployment target being set to 12.4 (which I set in the target's Build Settings). If I go to Xcode -> Preferences -> Platforms, I see "macOS 13.1" listed as built-in. Tapping on the + button there is no option for macOS. So my question is how do I support running a Mac Catalyst app on an Intel Mac running macOS 12.6 while using Xcode 14.2? Can it be done? What steps do I need to take? I've reloaded the project. I've restarted Xcode. I've done a clean build. Nothing changes.
1
0
2.8k
Jan ’23
Can a MailKit MEMessageActionHandler process all incoming messages?
As best as I can tell, the only messages sent to a MEMessageActionHandler for processing are those going to the Inbox. I'm trying to write a Mail extension that processes incoming messages, most importantly those that go straight to the Junk folder, but none of those messages go to the extension. Is there some setting I may be missing or can a MEMessageActionHandler only process emails going to the Inbox?
1
0
890
Aug ’22
How to change the app name shown in a Catalyst app?
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?
5
2
6.8k
Jan ’21
How to modify context menu shown in a UITextView?
In my iPad app running under macOS Catalyst I would like to modify the context menu that appears when you right-click on a UITextViiew but I can't figure out how.I have overridden the buildMenuWithBulder:/buildMenu(with:) method from UIResponder in my view controller and app delegate but none are called when right-clicking on a UITextView.I have been able to disable a couple of the menu options by subclassing UITextView and overriding the canPerformAction:withSender:/canPerformAction(_:withSender:) and targetForAction:withSender:/target(_:withSender:) methods but I can't remove/disable most of the menu.I also overrode the validateCommand:/validate(_:) method in my UITextView subclass and that was only called for a small subset of the menus I wish to remove/disable.The Menus sample app only shows how to modify the app's main menu and how to add a context menu to a view controller but there is no info on how to modify the context menu of a control such as UITextView.Does anyone know how to do this?Specifically I want to remove the Show Fonts and Show Colors menus under Font and I wish to remove the whole Substitutions menu. The allowsEditingTextAttributes property of the text view is enabled which is what makes the Font portion of the menu appear. I want to keep the Bold/Italic/Underline toggles.
2
0
3.2k
Nov ’19
How to get the AVCam demo app to work under Mac Catalyst?
My own iOS app is using AVFoundation to do barcode scanning. Under Mac Catalyst I'm getting an error. Turns out the Apple provided AVCam demo app has the exact same issue.Both the Swift and Objective-C versions of the AVCam demo app fail but the Objective-C version gives a better error so I'll refer to that in the rest of the question.In the AVCamCameraViewController, the configureSession method fails on the line:AVCaptureDeviceInput* videoDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];The error is:Could not create video device input: Error Domain=AVFoundationErrorDomain Code=-11814 "Cannot Record" UserInfo={NSLocalizedDescription=Cannot Record, NSLocalizedRecoverySuggestion=Try recording again.}It turns out that none of the three attempts to call [AVCaptureDevice defaultDeviceWithDeviceType:... are succeeding.This is the same error I get in my own app though I only attempt to call [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; which is also returning nil.Permission was granted for the app to access the camera.There is nothing related to this issue in the release notes for macOS 10.15. I am running the GM version of 10.15 with Xcode 11.1 on a 2018 15" Macbook Pro.How do we successfully get a video capture device under Mac Catalyst?
5
0
3.9k
Oct ’19
UISceneActivationConditions and UIApplicationShortcutItem
Just watched the Targeting Content with Multiple Windows video. My app uses UIApplicationShortcutItem and UIApplication.shortcutItems.So I thought it would be useful to set the targetContentIdentifier property of each shortcut item so when the user selects one of the shortcuts, they can be brought to the mose appropriate scene in the app.But UIApplicationShortcurItem targetContentIdentifer is a read-only property. Is this is mistake?The documentation for UISceneActiviationConditions states (emphesis mine):Many different objects contain a targetContentIdentifier property, including NSUserActivity, UNNotificationContent, and UIApplicationShortcutItem. When creating those objects, fill that property with a value that uniquely describes the event and matches your scenes' predicates.Kind of hard to do when the property is read-only.Am I missing something or is this an API bug?
1
0
941
Sep ’19