I have a button in my iOS app that opens the Settings app to my app's Notification permissions section. I use UIApplicationOpenSettingsURLString for this (or UIApplicationOpenNotificationSettingsURLString on iOS 15.4 and later). On Catalyst, both of these simply open the settings screen that is auto-generated from the Settings bundle.
How do I get it to open to the appropriate place in System Settings?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
This is a follow up to this post about building a Control Center widget to open the app directly to a particular feature. I have it working in a sample app, but when I do the same thing in my full app I get this error:
[[com.olivetree.BR-Free::com.olivetree.BR-Free.VerseWidget:com.olivetree.BR-Free.ContinueReadingPlanControl:-]] Control action: failed with error: Error Domain=ChronoKit.InteractiveWidgetActionRunner.Errors Code=1 "(null)"
Google has nothing for any of that. Can anyone shed light on what it means?
This is my control and its action:
@available(iOS 18.0, *)
struct ContinueReadingPlanControl : ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "com.olivetree.BR-Free.ContinueReadingPlanControl") {
ControlWidgetButton(action: ContinueReadingPlanIntent()) {
Image(systemName: "book")
}
}
.displayName("Continue Reading Plan")
}
}
@available(iOS 18.0, *)
struct ContinueReadingPlanIntent : ControlConfigurationIntent {
static let title: LocalizedStringResource = "Continue Reading Plan"
static let description = IntentDescription(stringLiteral: "Continue the last-used reading plan")
static let isDiscoverable = false
static let opensAppWhenRun: Bool = true
@MainActor
func perform() async throws -> some IntentResult & OpensIntent {
let strUrl = "olivetree://startplanday"
UserDefaults.standard.setValue(strUrl, forKey: "StartupUrl")
return .result(opensIntent: OpenURLIntent(URL(string: strUrl)!))
}
}
Note also that I'm pulling this from Console.app, streaming the logs from my device. I don't know of a way to debug a Control Center widget in Xcode, though this thread implies that it's possible.
I have a Catalyst app that uses popovers frequently, and I'd love to have them stay active when the app loses focus. It appears this is controlled in a native AppKit app via NSPopover.Behavior. Is this functionality exposed somewhere in Catalyst?
I've got an iOS app with a custom top toolbar view that uses a UIScrollEdgeElementContainerInteraction to achieve the iOS 26 progressive blur background. It's over top of a web view, and I've set the top edge effect style on its scroll view to .hard so the toolbar's edges are more defined.
I'm noticing that the blur doesn't extend fully to the bottom edge of the toolbar, and I'm curious to know if this is a bug or expected behavior. If the latter, what exactly are the details of what's expected? What determines the bottom extent of the blur?
I've got this result in a sample project on iOS 26.0. The white border is the label, and the red border is the title bar view itself. Note that the Daring Fireball logo visible inside the bounds of the bar view, and is cut off at the bottom edge of the label.
This is the code from the demo app that produced the screenshot.
let config = WKWebViewConfiguration()
let webView = WKWebView(frame: .zero, configuration: config)
self.view.addSubview(webView)
webView.translatesAutoresizingMaskIntoConstraints = false
webView.topAnchor.constraint(equalTo: self.view.topAnchor).isActive = true;
webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true;
webView.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true;
webView.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true;
webView.scrollView.topEdgeEffect.style = .hard
webView.load(URLRequest(url: URL(string: "https://daringfireball.net")!))
let barView = UIView()
self.view.addSubview(barView)
barView.translatesAutoresizingMaskIntoConstraints = false
barView.topAnchor.constraint(equalTo: self.view.topAnchor).isActive = true;
barView.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
barView.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true
let edgeEffect = UIScrollEdgeElementContainerInteraction()
edgeEffect.scrollView = webView.scrollView
edgeEffect.edge = .top
barView.addInteraction(edgeEffect)
barView.layer.borderColor = UIColor.red.cgColor
barView.layer.borderWidth = 1
let titleLabel = UILabel()
barView.addSubview(titleLabel)
titleLabel.translatesAutoresizingMaskIntoConstraints = false
titleLabel.leftAnchor.constraint(equalTo: barView.leftAnchor).isActive = true
titleLabel.rightAnchor.constraint(equalTo: barView.rightAnchor).isActive = true
titleLabel.bottomAnchor.constraint(equalTo: barView.bottomAnchor, constant: -20).isActive = true
titleLabel.topAnchor.constraint(equalTo: barView.safeAreaLayoutGuide.topAnchor, constant: 8).isActive = true
titleLabel.textAlignment = .center
titleLabel.text = "Title Here"
titleLabel.layer.borderColor = UIColor.green.cgColor
titleLabel.layer.borderWidth = 1
I want to offer a pay-as-you-go introductory offer for a subscription in my iOS app. But it's not clear to me what the actual pricing is if the offer is on a subscription whose period is more than 1 unit (2 month, 3 month, 6 month, etc).
For example, say I have a subscription that costs $20 per renewal and renews every 6 months. I set up an intro offer of the "Pay as you go" type (SKProductDiscountPaymentModePayAsYouGo) whose duration is 12 months and price is $10. Is the user going to get charged $10/month for 12 months (renewing 12 times), or $10 per 6 months for 12 months (renewing twice)?
The documentation - https://developer.apple.com/documentation/storekit/in-app_purchase/subscriptions_and_offers/implementing_introductory_offers_in_your_app?language=objc isn't all that clear on this. If I set this up with a local StoreKit test file - https://developer.apple.com/documentation/xcode/setting_up_storekit_testing_in_xcode?language=objc and try it in a simulator, the system purchase sheet appears to actually display it wrong. In my scenario above, the simulator shows a trial of "$10 per month for 2 months". I've filed this as FB8998598.
I have a UICollectionView that I feed data into using UICollectionViewDiffableDataSource. I want to display a scroll scrubber on the trailing edge of it, like I'd get if I implemented the data source methods indexTitlesForCollectionView and indexPathForIndexTitle. But the data source is the diffable data source object, and there's no property or closure on it to supply index titles as of iOS 15.
How are index titles supposed to work with UICollectionViewDiffableDataSource?
I have an iOS app that I'm looking to make available as a Catalyst app. I have various view controllers that I present using custom animations and presentation styles via UIViewControllerTransitioningDelegate, UIViewControllerAnimatedTransitioning, UIPresentationController, et al.
Most of the view controllers I present with my custom styles are UINavigationController instances (or subclasses thereof). And when I build and run my Catalyst app on Ventura, the titles and bar items for the navigation items of the view controllers in the navigation stack get moved to the title bar of the application, and the navigation bar doesn't appear at all in the presented view controller.
Why is this happening, and how do I stop it? I've looked through the documentation for the APIs I mentioned above and tried setting various things that seemed like they could conceivably be relevant - UIPresentationController.shouldPresentInFullscreen, UIViewController.modalInPresentation, etc - and have had no luck.
I'm adding some text formatting support to an editable text view in my app, and I want to include bulleted lists. I specifically want to have the standard behavior where if you're typing a line of text in a list and press Enter, the next bullet item is automatically inserted.
This appears to somewhat work out-of-the-box with NSTextList on iOS 16, unless the line you're editing is at the very end of the document. This is apparent in the sample code for WWDC 2022 session 10090 (project is here):
Run that sample app and switch to the List tab
Put your cursor at the end of any line except the last one and press enter. You get a new list item, as expected.
Put your cursor at the end of the very last line and press Enter. You don't get a list item until you type something on that line.
I've likewise found that if I have this text in a text view:
Hello World\n\nList here\n
If I format the text List here as a bulleted list (by creating an NSMutableParagraphStyle with its textLists property set and adding it to the attributed string for that range) and press Enter at the end of the word Here, I get a new bullet item automatically. But if I do the same thing without having that last newline after Here, the new list item is not inserted.
How can I make the list auto-continuation behavior work at the end of the document?
One of the things discussed in Understanding the exception types in a crash report is the 0xdead10cc code under EXC_CRASH (SIGKILL):
0xdead10cc (pronounced “dead lock”). The operating system terminated the app because it held on to a file lock or SQLite database lock during suspension.
My app gets killed this way here and there, and it's been on my project list for some time to make the requisite changes to database connection handling to fix it. With an App Store build, as far as I know it just means the app cold-starts when launched instead of resuming, but in a TestFlight build it actually shows a crash reporter dialog.
Reports of this issue from TestFlight users got more frequent with a recent update that had the effect of keeping more SQLite handles open longer, and I realized that I personally have never seen a crash reporter dialog after fast-app-switching away from a TestFlight build on my device. And I use the TF build as my daily driver, and I use my app a lot.
My question is this: is it possible that the 0xdead10cc crash doesn't happen on Developer Mode devices?
WWDC 2021 session 10064 introduced UIButtonConfiguration, a new way to configure the visual appearance of buttons, for iOS 15. I'm now in the process of switching all my button setup over to UIButtonConfiguration, and I've run into one situation where it doesn't apply: rounding specific corners of the button. CALayer has the maskedCorners property that lets you round or mask specific corners but not others. In transferring border radius, border width, and border color styling over to UIButtonConfiguration via UIBackgroundConfiguration, I don't see an equivalent UI. Am I missing something?
For now, in cases when I need the maskedCorners functionality, I'm falling back to using the layer for border properties.
I am working on supporting some formatted text editing in my app, and I've been experimenting with copy and paste support for formatted text. I discovered that NSAttributedString implements NSItemProviderWriting, which means I can give it to UIPasteboard via setObjects and all the built-in attributes transfer perfectly if I then paste it into another text view, or even another app that behaves itself.
But if I have custom attributes in my attributed string, having their values implement Codable doesn't let them transfer across the clipboard. In my implementation of textPasteConfigurationSupporting(_: transform:), I try to get an attributed string like this:
let attr = item.itemProvider.loadObject(ofClass: NSAttributedString.self) { val, err in
//...handle here
}
I get an error like this:
Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type com.apple.uikit.attributedstring" UserInfo={NSLocalizedDescription=Cannot load representation of type com.apple.uikit.attributedstring, NSUnderlyingError=0x600003e7bea0 {Error Domain=NSCocoaErrorDomain Code=260 "The file “b036c42113e34c2f9d9af14d6fefcbd534f627d6” couldn’t be opened because there is no such file." UserInfo={NSURL=file:///Users/username/Library/Developer/CoreSimulator/Devices/86E8BDD4-B6AA-4170-B0EB-57C74EC7DDF0/data/Library/Caches/com.apple.Pasteboard/eb77e5f8f043896faf63b5041f0fbd121db984dd/b036c42113e34c2f9d9af14d6fefcbd534f627d6, NSFilePath=/Users/username/Library/Developer/CoreSimulator/Devices/86E8BDD4-B6AA-4170-B0EB-57C74EC7DDF0/data/Library/Caches/com.apple.Pasteboard/eb77e5f8f043896faf63b5041f0fbd121db984dd/b036c42113e34c2f9d9af14d6fefcbd534f627d6, NSUnderlyingError=0x600003e7ac70 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}}}
But I tried making my custom attribute values implement NSSecureCoding, and then it worked.
Why is Codable conformance not enough here? Is it because the code that serializes and deserializes is still in Objective-C and isn't aware of Codable? Will this change as the open-source Foundation in Swift work continues?
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?
I have a Catalyst app that I'm adding a sidebar to via UISplitViewController. I have a toolbar on the window with buttons that I want to be enabled or disabled based on the state of the view controller in the split view's secondary column. But it seems to want to check the primary view controller instead.
In the Catalyst tutorial Adding a Toolbar, this exact approach is demonstrated. The RecipeDetailViewController has methods for toggleFavorite and editRecipe, and the toolbar items are set up to reference those selectors in the ToolbarDelegate class. In the screenshots in the tutorial, the buttons are shown as enabled based on RecipeDetailViewController.canPerformAction. But when I download and run the complete project on my computer (macOS 14.4.1), the toolbar items are disabled. And if I add the methods to the RecipeListViewController (which is in the primary column of the UISplitViewController, the toolbar items get enabled.
Is there a way to make the system ask the correct split view column for canPerformAction? Or is this a bug?
I have a Catalyst app that plays audio via AVQueuePlayer, and I'd like to use the system play/pause key (F8 on my MacBook Pro keyboard) to play and pause it. It doesn't seem to work automatically, and if I hook up a UIKeyCommand using UIKeyInputF8, it works with Fn-F8, not F8 on its own.
It does seem to work in Overcast's Mac app, but I think that's an iPad app for Mac, not Catalyst, so it's probably going through whatever system pathway that the Lock Screen controls would be using on iOS.
How do I make this work on Catalyst?