vinzscam / react-native-file-viewer

Native file viewer for React Native. Preview any type of file supported by the mobile device.
MIT License
434 stars 102 forks source link

Thread 1: "*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]" #129

Open my-name-is-nheo opened 2 years ago

my-name-is-nheo commented 2 years ago

Bug report

image

Summary

simulator crashes leading to this error, works fine on physical device

Reproducible sample code

RNFS.downloadFile(options) .promise.then(() => FileViewer.open(localFile, { onDismiss: () => RNFS.unlink(localFile) }) .then(() => console.log('File Success')) .catch(() => console.log('opening file')) ) .catch(() => displayMessage('cannot be viewed', true));

Environment info

npx react-native info output:

System:
    OS: macOS 12.0
    CPU: (8) x64 Apple M1 Pro
    Memory: 39.64 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    Yarn: Not Found
    npm: 8.1.4 - ~/.nvm/versions/node/v16.13.1/bin/npm
    Watchman: 2021.10.18.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7784292
    Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^17.0.2 => 17.0.2 
    react-native: ^0.66.3 => 0.66.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

library version: 2.1.5

iOS version: 15.0.0

swathytechversant commented 2 years ago

I am having the same issue, anyone have any solution for this. crash is in both simulator and real device. react: 17.0.2 react-native: 0.66.4 react-native-file-viewer: 2.1.5

palmsey commented 2 years ago

I'm getting the same error.

react: 16.13.1 react-native: 0.63.4 react-native-file-viewer: 2.1.5 iOS: 15.2

tdinckaya commented 2 years ago

same problem

palmsey commented 2 years ago

I think this is specific to M1 Macs. I noticed the same issue reported for a similar function in a different package: https://github.com/RonRadtke/react-native-blob-util/issues/80

tosifkhan01 commented 2 years ago

any solution yet?

@my-name-is-nheo @swathytechversant @tdinckaya @palmsey

georgetk commented 2 years ago

Hi, what @palmsey said is correct. This package isn't supporting the latest iOS version simulators on M1 Macs. But it is working fine in iOS version 13.7 simulator running on M1 Mac. I'm using iPhone 8 Plus simulator on M1 Mac and it works fine: npx react-native run-ios --simulator="iPhone 8 Plus (13.7)"

Also, I've verified the working of release version app in iPhone SE (14.1) device, iPhone 13 (15.1) device and iPhone 13 (15) browserstack (functionality worked but crashes occurred sometimes).

Specifically, I tried only this feature - await FileViewer.open(path);

ybrdev commented 2 years ago

Hi, what @palmsey said is correct. This package isn't supporting the latest iOS version simulators on M1 Macs. But it is working fine in iOS version 13.7 simulator running on M1 Mac. I'm using iPhone 8 Plus simulator on M1 Mac and it works fine: npx react-native run-ios --simulator="iPhone 8 Plus (13.7)"

Also, I've verified the working of release version app in iPhone SE (14.1) device, iPhone 13 (15.1) device and iPhone 13 (15) browserstack (functionality worked but crashes occurred sometimes).

Specifically, I tried only this feature - await FileViewer.open(path);

Just try and it worked on iPhone 11 simulator iOS 13.7 but it will crash on iOS 15.2

akucharczyk commented 2 years ago

Crashes now on Simulator and iOS device. iOS 15.5

ismail-sk commented 2 years ago

i Have same issue;

Thread 66: "*** -[_NSPlaceholderData initWithBase64EncodedString:options:]: nil string argument"

Crashes in iOS 15.4 and16.0 simulator

RN: 0.65.1 macOS montenery 12.6 ( intel i9 ) xCode 14

Maybe important a point! AND MAYBE SOLUTION -->

our backend server some time return 500 error even if we send same value and parameters. when 500 error hapen; our old code save this to storage. after saving; other codes try to read it and crashing on this point. so i recomend make sure you read a readable file and setted correct value for mimeType.

socialcode-rob1 commented 2 years ago

I'm seeing the same issue.

iOS simulator: iPhone 13 (iOS 15.5) react-native-filer-viewer: 2.1.5

Info

System:
    OS: macOS 12.3.1
    CPU: (8) arm64 Apple M1
    Memory: 110.05 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.17.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.15.0 - /opt/homebrew/bin/npm
    Watchman: 2022.09.05.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8815526
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.66.4 => 0.66.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
zhangfuchao commented 2 years ago

same problem

NguyenHoangMinhkkkk commented 2 years ago

same problem, crash every time FileViewer.open(path)

arm64 Apple M1 xcode 14.0.1 RN 0.63.4 RNFileViewer 2.1.5

MensurRasic commented 2 years ago

Same problem here!

murilokrugner commented 1 year ago

same problem, but on intel, contrary to what they are talking about