React-native: [iOS - RN 0.61.1 migration] Cannot release or run on real device because of the missing of React target in scheme

Created on 27 Sep 2019  路  16Comments  路  Source: facebook/react-native

React Native version:

System:
OS: macOS 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
Memory: 1.62 GB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.1 - ~/.nvm/versions/node/v10.15.1/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
API Levels: 23, 27, 28
Build Tools: 27.0.3, 28.0.2, 28.0.3
System Images: android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.1 => 0.61.1

Steps To Reproduce

  1. I migrate my project from 0.60.5 to 0.61.1 using upgrade-helper-tool
  2. Go to xcode --> Product Menu --> Scheme --> Edit Scheme --> In the build section we will see the Target React (missing)
  3. Try to press the '+' icon and find React but cannot find it
  4. Try to run the project on a real device or release it, then several dependencies will report errors such as:
  5. 'React/UIView+React.h' file not found
  6. 'React/RCTBridgemodule.h' file not found

Describe what you expected to happen:

It should run the project or release it normally just like the 0.60.5 version

Snack, code example, screenshot, or link to a repository:

This is my podfile:

`platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

def shared_pods
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'Firebase/Core', '~> 5.20.1'
pod 'RNFirebase', path: '../node_modules/react-native-firebase/ios'
pod 'FBSDKCoreKit', '~> 5.3.0'
pod 'FBSDKLoginKit', '~> 5.3.0'
pod 'FBSDKShareKit', '~> 5.3.0'
pod 'Mixpanel'
pod 'google-cast-sdk', '~> 3'
pod 'react-native-google-cast', path: '../node_modules/react-native-google-cast/ios/'
pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake'
pod 'lottie-ios', :path => '../node_modules/lottie-ios'
pod 'lottie-react-native', :path => '../node_modules/lottie-react-native'
pod 'RNShare', :path => '../node_modules/react-native-share'
end

target 'MyApp' do
shared_pods
target 'MyAppDev' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
`

- I already tried to remove the snippet:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end

Then reinstalled pods, then when I press + icon in Scheme Edit window, I can now find the React Target, but this target icon is different from the icon that I used to see before, and I also tried to run again but it not working also, you guys can see in the screenshot below:

_Before: The React icon is just like a bank icon_
image

_After: The new version makes it look like a bull's eye_
image

- I have tried to init a new react-native project, and the React target is also missing, but I can run that project because it's fresh and has no dependencies.

Any idea why this problem happens guys?, Thank you guys so much!

Bug iOS

Most helpful comment

Hello, I don't recommend we close this issue, it's still a bug, we're requiring Cocoa pods now, which should have been mentioned as a breaking change but wasn't

All 16 comments

I got the issue too :( Any workaround? I've tried to upgrade RN from 0.60.5 to 0.61.1 but when I rollback to 0.60.5 the error appears again.

It's okay when I rollback to RN 0.60.5, but I really want to use Fast Refresh and new stuffs. It's working on Android, the remaining problem is this problem

@nenjamin2405 - have you tried removing the target from the scheme dependencies? I'm wondering if it's still necessary to add here as it is now just a Pod like all other cocoapod dependencies

Hi @wildseansy, thanks for your response, I just tried to remove the React (missing) target, but it still has error.

image

But my question is why I can still run the project on an emulator, but not real device or release

After I upgraded several libs that have errors with 0.61.1, the errors belong to them disappeared. However, the build still cannot run because of remaining errors of some old libs which don't have the new compatible version with RN 0.61.1, e.g: react-native-mixpanel is still reporting the missing of React/RCTBridgeModule.h.

So how can I handle those libs which are currently inactive or don't have any plan to create new compatible version to new RN 0.61.1 version?

I found a workaround by adding a Podfile to each of the projects that gave me the error and running them through Pod... not ideal, but it works.

Have you tried to set in xcode the legacy build system? I don't know if that is a wrong option to set in RN projects but it works for me...

I already set xcode settings to legacy build system 馃槶

Hi @kennym, could you please clarify the flow of adding a Podfile to each of the projects? I didn't have any experience on that, what exactly is the content of the Podfile, how can I add it, could you please send me example tutorial, thanks!

@nenjamin2405 look at other projects which use Cocoapods... I copied the Podfile of other projects, put them into the projects that I was having trouble with, removed all statically linked references in Xcode, added dependency to Podfile, and things started working.

@kennym I just followed exactly what you said, and awesome, now everything is working fine on iOS. Thanks a lot!!! 馃槏馃槏

  • For those who are facing this problem because of using RN 0.61.1, please make sure to remove all statically linked references in Xcode for old libs, then re-install all libraries using Cocoapods. If you are using react-native-orientation and cannot find the Cocoapods instruction because it's inactive, I recommend you to migrate to react-native-orientation-locker which is using the same APIs but with Cocoapods instruction

Hello, I don't recommend we close this issue, it's still a bug, we're requiring Cocoa pods now, which should have been mentioned as a breaking change but wasn't

Idem... as I said - this is a workaround not a solution.

I'm getting after upgrading to this version as well:
No podspec found for React-Core in ../node_modules/react-native/React
Is it linked?

I'm also suffering from this problem. Changing imported Node packages to have a podspec and then pod installing them has worked for some, though not all, of them, but I use BuddyBuild to build my app and it installs the original version from Github, not my locally amended version, so I still get the build error.

@hugoh59 No, it's not - you've got the wrong path in your Podfile. It should be
pod 'React-Core', :path => '../node_modules/react-native/'

Thanks @kennym on the 'workaround'. 馃槤
For those who are still facing issue, I have opened an issue in stackoverflow, with the 'workaround steps' posted.

Was this page helpful?
0 / 5 - 0 ratings