react-native: Xcode 11: Error loading local image when build release

In Xcode 10 everything is okay but after upgraded to Xcode 11 and build release, the local image not showing in iOS both Simulator and Real Device.

React Native Environment Info:
    System:
      OS: macOS 10.14.6
    Binaries:
      Node: 10.13.0 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    IDEs:
      Xcode: 11.0/11A420a - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.9 => 0.59.9 
    npmGlobalPackages:
      react-native-cli: 2.0.1

Steps To Reproduce

  1. react-native run-ios --configuration Release either run release from Xcode
  2. Local image not showing
react-native run-ios react-native run-ios --configuration Release

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 24

Most upvoted comments

@pabloluz I temporarily fixed this issue by the following:

  1. Navigate to project directory => ios => Create folder assets
Screen Shot 2562-10-30 at 8 54 35 AM
  1. Inside folder assets => create folder structure same as folder where you keep image in the project (In my case I kept all the images in app > src > assets > image) and copy all images to this folder

  2. Open Xcode => Select project target => Build Phases

  3. Drag folder assets which we have created into Copy Bundle Resources

Screen Shot 2562-10-30 at 9 15 00 AM
  1. Select Copy items if needed and press Finish
Screen Shot 2562-10-30 at 9 16 16 AM
  1. Clean project and Build release again

Done!

PS: If your images name like this my_image.ios.jpg you need to rename them to my_image.jpg.

In my case I was using resizeMode=‘center’ and when I changed from ‘center’ to ‘contain’ it solved my problem.

same me too, after main.jsbundle set to Copy Bundle Resource. Local Image not show if release scheme. On debug scheme Local image showing.

RN: 0.60.4

any solution for this issue ?

Local Image not show if release scheme. On debug scheme Local image showing. RN: 0.61.5 any solution for this issue ?

@pabloluz I temporarily fixed this issue by the following:

  1. Navigate to project directory => ios => Create folder assets
Screen Shot 2562-10-30 at 8 54 35 AM
  1. Inside folder assets => create folder structure same as folder where you keep image in the project (In my case I kept all the images in app > src > assets > image) and copy all images to this folder
  2. Open Xcode => Select project target => Build Phases
  3. Drag folder assets which we have created into Copy Bundle Resources
Screen Shot 2562-10-30 at 9 15 00 AM
  1. Select Copy items if needed and press Finish
Screen Shot 2562-10-30 at 9 16 16 AM
  1. Clean project and Build release again

Done!

PS: If your images name like this my_image.ios.jpg you need to rename them to my_image.jpg.

not working this steps in Xcode 12

In my case I was using resizeMode=‘center’ and when I changed from ‘center’ to ‘contain’ it solved my problem.

Works for me

Started experiencing the same issue with RN 0.59.9 after it had worked fine for months. I suspect it does indeed have to do with an Xcode update. Does anyone know if this is occuring on newer RN versions as well?