I have just upgraded from Xcode 11 to Xcode 12 (on MacOS Catalina).
The following are several things that I have done after the upgrade and I am seeking advice for two things: Do some of the problems I am facing indicate possible problems in the Xcode installation? Should I uninstall Xcode and install again?
or, am I doing anything wrong?
I have created a new react-native project. I need it to be in RN 0.59.9, so I have used:
react-native init --version="react-native@0.59.9" myproject
When I open myproject.xcodeproj in Xcode, main.jsbundle is marked red (not available), I am not sure why (something wrong with the upgrade to Xcode 12?).
You can see the screenshot in https://stackoverflow.com/questions/64523206/problems-building-a-new-react-native-project-in-xcode
Anyway, the project is running on a simulator.
Then, I want to use cocapods, so I close the project, delete derivedData, and run pod init and pod install. Then I open myproject.xcworkspace in Xcode, and this is what I see:
You can see the screenshot in https://stackoverflow.com/questions/64523206/problems-building-a-new-react-native-project-in-xcode
I assume that this is not what should be displayed. The project is still running on the simulator, I am just curious to know if I am doing anything wrong.
Now, I modify the Podfile to the contents shown below.
I open the project again in Xcode and delete from 'frameworks, libraries and emebedded content' all the libraries so that only the JavaScriptCore.framework and Pods_myproject.framework are left (which may be a problem, since the later is marked in red in the project tree).
Now the build fails with the error ld: framework not found React.
So, wrong Xcode installation, my mistakes? Both?
Here is the Podfile after my modifications:
platform :ios, '11.0'
target 'myproject' do
Comment the next line if you don't want to use dynamic frameworks
useframeworks!
Pods for myproject
rnpath = '../nodemodules/react-native'
pod 'React', path: rnpath, subspecs: [
'CxxBridge',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
'RCTAnimation',
'RCTActionSheet',
'RCTGeolocation',
'RCTImage',
'RCTSettings',
'RCTVibration',
'RCTLinkingIOS'
]
pod 'yoga', :path => "#{rnpath}/ReactCommon/yoga"
pod 'DoubleConversion', :podspec => '../nodemodules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../nodemodules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../nodemodules/react-native/third-party-podspecs/Folly.podspec'
target 'myprojectTests' do
inherit! :searchpaths
Pods for testing
end
postinstall do |installer|
installer.podsproject.targets.each do |target|
if target.name == "React"
target.removefrom_project
end
end
end
end