Post

Replies

Boosts

Views

Created

Crash in Swift 6 when using UNUserNotification
After porting code to Swift 6 (Xcode 16.4), I get a consistent crash (on simulator) when using UNUserNotificationServiceConnection It seems (searching on the web) that others have met the same issue. Is it a known Swift6 bug ? Or am I misusing UNUserNotification ? I do not have the crash when compiling on Xcode 26 ß5, which hints at an issue in Xcode 16.4. Crash log: Thread 10 Queue : com.apple.usernotifications.UNUserNotificationServiceConnection.call-out (serial) As far as I can tell, it seems error is when calling nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) I had to declare non isolated to solve a compiler error. Main actor-isolated instance method 'userNotificationCenter(_:didReceive:withCompletionHandler:)' cannot be used to satisfy nonisolated requirement from protocol 'UNUserNotificationCenterDelegate' I was advised to: Add 'nonisolated' to 'userNotificationCenter(_:didReceive:withCompletionHandler:)' to make this instance method not isolated to the actor I filed a bug report: Aug 10, 2025 at 2:43 PM – FB19519575
5
0
223
Aug ’25
Cannot close my own threads
Since recently, when I try to close a thread I created on an answer of mine, I get the following error: Trying later, next day, does not solve it. In the list of all threads, the post is not marked as answered. But if I look via Chrome or plain Safari, I see the answer itself is marked as correct: Which is not the case when opening in Safari Technology Preview (Release 233) where the same answer is still to be accepted:
3
0
287
3d
Where to find sample code for SB2420 compliance and questions
I'm struggling to implement required code for SB2420 compliance. I try to learn on a very simple use case. the app is UIKit Build in Xcode 26.2 it displays a single Hello view with a button that will simply show a "Good day" label. I assume the app will be rated 4+. I tried the following code, using available information in Xcode (limited): import UIKit import DeclaredAgeRange // other import needed ? class ViewController: UIViewController { @IBOutlet weak var welcomeLabel: UILabel! // initially hidden override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } func testAgeRange() -> Bool { if !isEligibleForAgeFeatures { // Not found. Which import needed ? return true // Not called from Texas } // Following code from Xcode doc… do { let response = try await AgeRangeService.shared.requestAgeRange(ageGates: 13, 15, 18) // Compiler Error: Missing argument for parameter 'in' in call // Can I add the 4 gate ? guard let lowerBound = response.lowerBound else { // Allow access to under 13 features. return false } var ok = false if lowerBound >= 18 { // Not needed ? // Allow access to 18+ features. ok = true } else if lowerBound >= 15 { // Not needed ? // Allow access to 15+ features. ok = true } else if lowerBound >= 13 { // Not needed ? // Require parental consent ? // Allow access to 13+ features. ok = true // if consent OK } else { // Require parental consent ? // Show age-appropriate content ok = true // if consent OK } return ok // Authorized for all 4+ } catch AgeRangeService.Error.notAvailable { // No age range provided. return false } } func executeStart() { welcomeLabel.isHidden = false } @IBAction func start(_ sender: UIButton) { if #available(iOS 26.0, *) { if testAgeRange() { // Need to test for parental control here ? } else { // Alert and exit the app ? } } else { // do nothing ? Can we run the app ? } executeStart() } } The logic would be: before allowing action with the start button, check is it IOS 26+ so that we can call API if so, is verification needed (Texas SB2420) if not, we can proceed if required, test age range As app is 4+, all ranges should be OK But need to test parental control Now, many pending questions in code: line 14: get an error: Cannot find 'isEligibleForAgeFeatures' in scope line 19: I used the documentation sample for AgeRangeService, but get a Compiler Error: Missing argument for parameter 'in' in call line 35: how to implement parental control ? In addition, in the metadata of the app, should I declare that parental control ? Age verification? Mechanism for confirming that a person's age meets the age requirement for accessing content or services As there is no restriction on age, is it required ? Any help welcomed as well as link to a comprehensive tutorial.
2
0
167
2d