Post

Replies

Boosts

Views

Activity

Reply to Dictionary crashed when updating value or init(capacity:) on iOS 14
At first glance this looks like a straightforward out-of-memory situation. EXC_BREAKPOINT points to a Swift runtime error, and 16 lines into the swift_slowAlloc method it calls a crash method if malloc (or one of its variants) returns a non-truthy value. (https://github.com/apple/swift/blob/aaff37ffb872117cc2697920f85d8743b26a06cc/stdlib/public/runtime/Heap.cpp#L102)
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
Reply to Implement UNUserNotificationCenterDelegate in iOS app using Swift6
My hunch is that the UNUserNotificationCenter code hasn't gotten the Swift 6/strict concurrency checking treatment by Apple yet. I encountered a similar problem with QLPreviewControllerDelegate and learned of a syntax where you can prepend @preconcurrency to the protocol conformance: final class NotificationServiceDelegate: UIResponder, UIApplicationDelegate, @preconcurrency UNUserNotificationCenterDelegate ... This will let you remove the nonisolated from the protocol methods and fix (or at least silence) the error. A side note for those reading, you'll want to use the async versions of User Notification methods in Swift 6 code where available. The completion-handler-based methods can crash with a __dispatch_queue_assert assertion.
Feb ’25
Reply to Dictionary crashed when updating value or init(capacity:) on iOS 14
At first glance this looks like a straightforward out-of-memory situation. EXC_BREAKPOINT points to a Swift runtime error, and 16 lines into the swift_slowAlloc method it calls a crash method if malloc (or one of its variants) returns a non-truthy value. (https://github.com/apple/swift/blob/aaff37ffb872117cc2697920f85d8743b26a06cc/stdlib/public/runtime/Heap.cpp#L102)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to How to fix MainActor warning for QLPreviewControllerDelegate
IMO this definitely should be marked @MainActor (reported as FB14256770) but thanks for the workaround!
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to Implement UNUserNotificationCenterDelegate in iOS app using Swift6
My hunch is that the UNUserNotificationCenter code hasn't gotten the Swift 6/strict concurrency checking treatment by Apple yet. I encountered a similar problem with QLPreviewControllerDelegate and learned of a syntax where you can prepend @preconcurrency to the protocol conformance: final class NotificationServiceDelegate: UIResponder, UIApplicationDelegate, @preconcurrency UNUserNotificationCenterDelegate ... This will let you remove the nonisolated from the protocol methods and fix (or at least silence) the error. A side note for those reading, you'll want to use the async versions of User Notification methods in Swift 6 code where available. The completion-handler-based methods can crash with a __dispatch_queue_assert assertion.
Replies
Boosts
Views
Activity
Feb ’25
Reply to How can I add a folder to my app's bundle
Figured it out thanks to some help from another engineer: You now have to select "Apply Once to Folder" as the value for Build Rules in the file inspector.
Replies
Boosts
Views
Activity
May ’25