Skip to content

fix(messaging): settle iOS permission requests on the main thread - #296

Open
anjak03 wants to merge 1 commit into
NativeScript:mainfrom
anjak03:fix/messaging-permission-main-thread
Open

anjak03 wants to merge 1 commit into
NativeScript:mainfrom
anjak03:fix/messaging-permission-main-thread

Conversation

@anjak03

@anjak03 anjak03 commented Dec 2, 2026

Copy link
Copy Markdown

What is the current behavior?

On iOS, hasPermission() and requestPermission() settle from UNUserNotificationCenter completion handlers, which run on a background queue. Code after the await runs on that thread, and when it updates views iOS aborts the app with _AssertAutoLayoutOnAllowedThreadsOnly once the thread exits.

What is the new behavior?

Both settle on the main thread through Utils.dispatchToMainThread. The duplicated reject(err) in requestPermission() is removed.

Verified with the same change applied to the published 5.0.0-alpha.4 build in a production Angular app on an iOS 26.1 simulator: opening the screen that awaits hasPermission() crashed 7 of 8 times before, 0 of 5 after.

Fixes #295.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 11c9ecdc-19e0-4e3c-ba57-6b1b439e0bda

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Messaging] iOS: hasPermission resolves on a background thread, app crashes when views update

1 participant