React-native-document-picker: App closes after picking a file iOS (Apple M1 Chip)

Created on 12 Mar 2021  路  6Comments  路  Source: rnmods/react-native-document-picker

Bug report

Summary

When using a machine with M1 chip, running the app on an iOS simulator and picking any file will close the app without any errors on the react native console. I was able to get an error when running the app using xcode

Reproducible sample code

  • The app just closes on after picking a file without any errors so I ran the app on xcode and got this error
    unknown

Steps to reproduce

  1. Use the latest version of the library on an iOS simulator
  2. Machine has to have an M1 chip

Describe what you expected to happen:

  1. when running via react native run-ios the app will close after picking any file
  2. running with xcode will show the error on the image after picking any file

Environment info

npx react-native info output:

System:
    OS: macOS 11.2.3
    CPU: (8) x64 Apple M1
    Memory: 124.29 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.11.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 7.6.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK: Not Found
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: /undefined - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

library version: 5.0.1

iOS: 14.4

All 6 comments

Having the same issue with MacBook Pro M1 (Big Sur 11.2.1) and iOS Simulator (14.4). Exact same error as described above.
I have cross tested the same project on a Mac Pro with Catalina and Intel - works flawlessly.
Any idea what the reason could be?

Facing the same issue with MBP M1. Looking for the fix.

One solution was to delete line 113. But I don't know if it will cause a problem.

https://developer.apple.com/documentation/coreservices/1448939-uttypecreatepreferredidentifierf according the documentation uti can be null. idk what cause it but on silicon macs its return null and crash.

for now i changed like this: if (uti) { CFRelease(uti); }
everything is fine on emulator, also on physical device uti isn't null and CFRelease(uti) works.

https://developer.apple.com/documentation/coreservices/1448939-uttypecreatepreferredidentifierf according the documentation uti can be null. idk what cause it but on silicon macs its return null and crash.

for now i changed like this: if (uti) { CFRelease(uti); }
everything is fine on emulator, also on physical device uti isn't null and CFRelease(uti) works.

Thanks! This is working perfectly.

https://developer.apple.com/documentation/coreservices/1448939-uttypecreatepreferredidentifierf according the documentation uti can be null. idk what cause it but on silicon macs its return null and crash.
for now i changed like this: if (uti) { CFRelease(uti); }
everything is fine on emulator, also on physical device uti isn't null and CFRelease(uti) works.

Thanks! This is working perfectly.

i'm happy to help but i forgot to mention about type issue, type returns null and it may occurs some problems.
for example in android, if type has not valid value, then the request throw an error 'Network Error'.
in ios it didnt happen to me and i implement all features that expected, but it may useful to be careful 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrey-shostik picture andrey-shostik  路  9Comments

rajeshkos picture rajeshkos  路  6Comments

Gentlee picture Gentlee  路  8Comments

behera786 picture behera786  路  9Comments

IvanCaceres picture IvanCaceres  路  6Comments