react-native-community / upgrade-helper

⚛️ A web tool to support React Native developers in upgrading their apps.
https://react-native-community.github.io/upgrade-helper
MIT License
3.67k stars 112 forks source link

React Native 0.62 upgrade (Xcode) #191

Closed pvinis closed 4 years ago

pvinis commented 4 years ago

Moved here: https://github.com/react-native-community/upgrade-support/issues/13

--

For an easy upgrade experience of the Xcode project file, do the following:

  1. First easy change, the organization name:
2

Click on Project Navigator (1), then on your project at the top (2), then click on Inspectors (3) and finally on File Inspector (4). Then delete the text Facebook on the Organization field (5), and leave empty or replace it with your own text.

After this step, you should have some git changes for the organization. Feel free to commit before continuing, try to run your project and note if it runs or not.

  1. Second, you need to do a project localization migration and recommended settings update.
Screen Shot 2020-03-30 at 11 44 13 Screen Shot 2020-03-30 at 11 44 27

Click on Issue Navigator (1), then click on Migrate (2) and after that on Update to recommended settings (3). You might need to try to build the project (by pressing cmd-B) to have these options appear. After clicking on both, just press OK or Next and do as Xcode suggests.

After this step, you should have some git changes on the xcscheme files and on the project.pbxproj file, regarding some version upgrades, some English translations and a few options like ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES. Make sure to commit once again before continuing, try to run your project and note if it runs or not.

  1. Third step, you need to go to the Project Navigator again, like the first step, then right-click on any of the files in your project, like AppDelegate.m, and click New File....
5

A sheet will appear, select Swift File and click Next.

6

Another sheet will appear, click Create.

7

Most probably one last sheet will appear, click Create Bridging Header. If that doesn't appear, keep going.

8

In the Project Navigator, select the newly-created File.swift file, right-click it and click Delete.

9

An alert will appear, click Move to Trash.

10

After this step, you should have a bunch of git changes for SWIFT_VERSION and CLANG_ENABLE_MODULES etc. Again, commit before continuing, try to run your project and note if it runs or not.

  1. Last step, you need to edit the LIBRARY_SEARCH_PATHS setting.
11

Click on the Project Navigator like the first step, then on your project at the top like the first step. Then click on the project right above the targets (1). If you don't see this sidebar, click on the icon (0). Click on Build Settings (2) and in the search write LIBRARY_SEARCH_PATHS (3). Double-click on the empty space (4) and using the + button (5), add the three values, in order: "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)", "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)", "$(inherited)".

After this step you should have some git changes again, you can commit and try to run your project again, and note if it runs or not.

At this point your Xcode project upgrade should be done, your project should be running and your changes should be committed. If your project doesn't run, make sure to try to Clean the project before running by pressing cmd-option-shift-K to clean, then cmd-B to build or cmd-R to run. If you are still having some trouble, feel free to make an issue on the upgrade-support repo giving us as much info as you can about what steps you did, which one if failed on etc, and we will try to help and improve this document.

I have done the above process on a repo here, where I upgrade from a working project in 0.61 to a working project in 0.62.