Skip to content

expo-notifications: Crash in requestAuthorizationOptions with expo-updates reloadAsync #32073

@mfazekas

Description

@mfazekas

Minimal reproducible example

https://github.com/mfazekas/exp-not-crash

It's an expo project with iOS created via expo prebuilt and configured EX_UPDATES_NATIVE_DEBUG so expo-updates works in debug build https://docs.expo.dev/eas-update/debug/#ios-local-builds

Press the Ask for notify & reload and wait for at leas 2 sec before pressing above so app reloads.

What platform(s) does this occur on?

iOS

Where did you reproduce the issue?

in a standalone app

Summary

Calling Notifications.requestPermissionsAsync causes a crash on iOS.

image

image

We don't use the latest version of the code. But the bug seems to be present in latest version:

- (void)requestAuthorizationOptions:(UNAuthorizationOptions)options withResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject
{
EX_WEAKIFY(self);
[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError * _Nullable error) {
EX_STRONGIFY(self);
// getPermissions blocks method queue on which this callback is being executed
// so we have to dispatch to another queue.
dispatch_async(self.methodQueue, ^{
if (error) {
reject(@"ERR_PERMISSIONS_REQUEST_NOTIFICATIONS", error.description, error);
} else {
resolve([self getPermissions]);
}
});
}];
}

Environment

expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.5
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.20.2 - ~/.nvm/versions/node/v18.20.2/bin/node
      Yarn: 3.4.1 - ~/.nvm/versions/node/v18.20.2/bin/yarn
      npm: 10.5.0 - ~/.nvm/versions/node/v18.20.2/bin/npm
      Watchman: 2024.08.26.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.14.2 - /Users/boga/.rbenv/shims/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
    IDEs:
      Android Studio: 2024.1 AI-241.15989.150.2411.11948838
      Xcode: 15.4/15F31d - /usr/bin/xcodebuild
    npmPackages:
      react-dom: 18.2.0 => 18.2.0 
      react-native: 0.74.5 => 0.74.5 
      react-native-web: 0.19.10 => 0.19.10 
    npmGlobalPackages:
      eas-cli: 12.5.2
    Expo Workflow: managed

Expo Doctor Diagnostics

% npx expo-doctor@latest
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check native tooling versions
✔ Check if the project meets version requirements for submission to app stores
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for app config fields that may not be synced in a non-CNG project
✔ Check for issues with metro config
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✖ Check that packages match versions required by installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that native modules use compatible support package versions for installed Expo SDK

Detailed check results:

The following packages should be updated for best compatibility with the installed expo version:
  [email protected] - expected version: ~51.0.38
  [email protected] - expected version: ~4.0.28
  [email protected] - expected version: ~0.25.27
Your project may not work correctly until you install the expected versions of the packages.
Found outdated dependencies
Advice: Use 'npx expo install --check' to review and upgrade your dependencies.

One or more checks failed, indicating possible issues with the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs reviewIssue is ready to be reviewed by a maintaineroutdated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions