Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expo-contacts] [iOS] Passing an Image to Contacts.presentFormAsync crashes Expo Go #25128

Closed
hueter opened this issue Oct 31, 2023 · 3 comments

Comments

@hueter
Copy link
Contributor

hueter commented Oct 31, 2023

Minimal reproducible example

https://github.com/hueter/expo-contacts-image-bug

Summary

Hello!

In my app I'm trying to preload a contact's image from a URI provided, but it seems to crash everything on iOS.

Crash Video

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2023-10-30.at.20.49.39.mp4

Repro

In my minimal reproducible example, it's this line that breaks:

https://github.com/hueter/expo-contacts-image-bug/blob/d80fa42892849957105e11afc00183a6205a9f7b/App.tsx#L17-L19

It also seems to break with base64-encoded images.

Console / Crash Report

This shows up in the console:

Screenshot 2023-10-30 at 8 53 25 PM

so I think it's this line that is having problems:

reject(@"E_CANNOT_OPEN", @"Could not open provided image", nil);

Here is the crash report (not sure if helpful 😅 )

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: CF3825A5-D2F2-4B7C-ADF5-23C61ADB7514
CrashReporter Key:   95002A4A-5FDC-6E4B-C74F-C8F94E6325A4
Hardware Model:      MacBookPro18,1
Process:             Expo Go [42807]
Path:                /Users/USER/Library/Developer/CoreSimulator/Devices/CD326108-6523-4BC3-B958-70BC8411AFEE/data/Containers/Bundle/Application/36A89978-31A4-4D4C-A792-8652BC3635F2/Exponent-2.29.6.tar.app/Expo Go
Identifier:          host.exp.Exponent
Version:             2.29.6 (2.29.6)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [39664]
Coalition:           com.apple.CoreSimulator.SimDevice.CD326108-6523-4BC3-B958-70BC8411AFEE [44357]
Responsible Process: SimulatorTrampoline [13444]

Date/Time:           2023-10-30 20:49:36.6073 -0400
Launch Time:         2023-10-30 20:49:21.5938 -0400
OS Version:          macOS 14.0 (23A344)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: Expo Go [42807]

Triggered by Thread:  0

Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter

Environment

 expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 14.0
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.18.1 - ~/.nvm/versions/node/v18.18.1/bin/node
      Yarn: 1.22.19 - ~/.nvm/versions/node/v18.18.1/bin/yarn
      npm: 9.8.1 - ~/.nvm/versions/node/v18.18.1/bin/npm
      Watchman: 2023.09.25.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.14.2 - /Users/hueter/.rvm/gems/ruby-3.2.2/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    IDEs:
      Android Studio: 2022.3 AI-223.8836.35.2231.10811636
      Xcode: 15.0.1/15A507 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~49.0.15 => 49.0.16
      react: 18.2.0 => 18.2.0
      react-native: 0.72.6 => 0.72.6
    npmGlobalPackages:
      eas-cli: 5.4.0
    Expo Workflow: managed
@hueter hueter added the needs validation Issue needs to be validated label Oct 31, 2023
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Oct 31, 2023
@Kudo Kudo added iOS Contacts Issue accepted and removed needs review Issue is ready to be reviewed by a maintainer labels Oct 31, 2023
@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@brentvatne
Copy link
Member

I believe the intent here was that you pass in a local image URI, however that is missing from the documentation. You can use FileSystem.downloadAsync to download the remote image, then pass in that local URI to the contacts API

@hueter
Copy link
Contributor Author

hueter commented Nov 1, 2023

I believe the intent here was that you pass in a local image URI, however that is missing from the documentation. You can use FileSystem.downloadAsync to download the remote image, then pass in that local URI to the contacts API

Thanks for the reply! I implemented those changes on my repro repository in this commit, and it fixed the issue in the simulator / Expo Go:

Screenshot 2023-10-31 at 8 06 00 PM

I also opened #25150 in case that will help avoid this crash in the future.

Feel free to close this issue if it's not an actual "bug"!

amandeepmittal pushed a commit that referenced this issue Nov 13, 2023
<!-- disable:changelog-checks -->

# Why

Helps users avoid crash behavior outlined in #25128

# How

Updated the TypeScript JS Doc string using [these
guidelines](https://github.com/expo/expo/blob/sdk-49/CONTRIBUTING.md#-updating-documentation).

# Test Plan

### Before

<img width="1013" alt="Screenshot 2023-11-01 at 12 05 48 PM"
src="https://github.com/expo/expo/assets/13444851/7405185d-faf5-425f-9416-5bde872034e8">


### After

<img width="995" alt="Screenshot 2023-11-01 at 11 55 18 AM"
src="https://github.com/expo/expo/assets/13444851/b11fe9ec-da21-415c-b1e9-f19282a4a993">



# Checklist

- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [x] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
onizam95 pushed a commit to onizam95/expo-av-drm that referenced this issue Jan 15, 2024
<!-- disable:changelog-checks -->

# Why

Helps users avoid crash behavior outlined in expo#25128

# How

Updated the TypeScript JS Doc string using [these
guidelines](https://github.com/expo/expo/blob/sdk-49/CONTRIBUTING.md#-updating-documentation).

# Test Plan

### Before

<img width="1013" alt="Screenshot 2023-11-01 at 12 05 48 PM"
src="https://github.com/expo/expo/assets/13444851/7405185d-faf5-425f-9416-5bde872034e8">


### After

<img width="995" alt="Screenshot 2023-11-01 at 11 55 18 AM"
src="https://github.com/expo/expo/assets/13444851/b11fe9ec-da21-415c-b1e9-f19282a4a993">



# Checklist

- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [x] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
@hueter hueter closed this as completed May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants