error Couldn't find "PLATFORM_NAME" variable in xcodebuild output

Viewed 7935

I'm trying to run my application on an iPhone simulator. from the console, I can see the build was successful. but on the next line, I get this.

error Couldn't find "PLATFORM_NAME" variable in xcodebuild output. Please report this issue and run your project with Xcode instead. react-native.

7 Answers

This is quite bizarre, but after getting this error I opened up the workspace in Xcode and ran it from there. Afterwards this error went away when running react-native run-ios

I suspect this might have something to do with the way Xcode 12 optimizes builds and that re-building it from Xcode somehow fixed it. I would like to know why, but I cbf'ed figuring it out myself.

This happened to me because I clean up some image, and removed some native dependancies. All I did was cd ios && pod install then yarn ios to build again.

Tried cleaning build folder and ran, it worked.

Xcode toolbar -> Product -> Clean build folder

Step - 1: Clean the build folder from Xcode.

Xcode toolbar -> Product -> Clean build folder

Step - 2: Delete the App installed in the device/simulator

Step - 3: Go to VSCode and move to ios directory using command line and just to be on the safer side, run the following command (just to remove build folder via VSCode as well)

rm -rf build

Step - 4: Run

pod install

Step - 5: Go back to the project folder and build the app again:

npx react-native run-ios

Context: react-native upgrade fails and cleaning the build folder doesn't work.

What works:

  • Trash out the node_modules folder.
  • Make yarn install to re-create dependencies.

It doesn't have any impact on "Podfile", but if you (future users) did, remove Podfile.lock, go to the ios folder and run pod install again. It must solve.

This is obviously overkill, but a reboot fixed this problem for me. I turned off my computer and turned it on again, and it's now working well.

When I log in to "Podfile" I will not be able to say why it does not work, but if you (future users) do it, remove Podfile.lock, go to the ios folder and run it again pod install. It must be resolved

Related