Closed AdarshJais closed 1 year ago
:warning: | Missing Reproducible Example |
---|---|
:information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
Hi there!
I want to know shall we just change the .m to .mm and it will work (which I feel is not the case) or We should create a new file. If we need to create the new one how we are going to handle the existing code that we have inside the AppDelegate.m file (I am not much aware of ios development)?
Yes, but only if you rename it from within Xcode
In case I just delete my AppDelegate.m file completely and add AppDelegate.mm that is mentioned inside the upgrade helper link, I get the error 9 Duplicate symbols for architecture x86_64 Also, I have ignored the change mentioned for
project.pbxproj
in the upgrade helper link, assuming that it will be autogenerated while building project. (Am I correct here?)
No, you shouldn't have ignored that. The project.pbxproj
is not automatically generated and it has an "hardcoded" list of filenames that uses to generate the project. Xcode takes care of keeping them in sync, so when you rename a file in Xcode, the project.pbxproj
is updated correctly.
Deleting the .m
and recreating the .mm
is unlikely to work.
The smoothest and quickest way to do it is:
bundle exec pod install
<yourApp>.xcworkspace
in XcodeAppDelegate.m
to AppDelegate.mm
in xcode.The last step needs to be done in Xcode because otherwise Xcode is not aware of the rename (it doesn't look at the file system to create the project.)
The two files are exactly the same. The .mm
is needed to actually use and import C++ files, but functionally, can be exactly the same as the .m
file.
Then, if you want to simplify your AppDelegate furthermore and have an easier time with future updates, you can look at the RCTAppDelegate
class.
Ideally the steps are:
AppDelegate.h
to extend the RCTAppDelegateAppDelegate.mm
and remove the code that is duplicated between your AppDelegate.mm
and the RCTAppDelegate.mm
.You can use the template AppDelegate.h
and AppDelegate.mm
files as an example of what the final situation should be.
Followed every step and again finally stuck on the same issue.
9 duplicate symbols for architecture x86_64
It's a little hard to help out without knowing which symbols are. A couple of tricks:
New Version
0.72.3
Old Version
0.67.5
Build Target(s)
iOS
Output of
react-native info
System: OS: macOS 13.2.1 CPU: (8) arm64 Apple M2 Memory: 79.05 MB / 8.00 GB Shell: version: 5.8.1 path: /bin/zsh Binaries: Node: version: 20.5.0 path: /opt/homebrew/bin/node Yarn: version: 1.22.19 path: /usr/local/bin/yarn npm: version: 9.8.0 path: /opt/homebrew/bin/npm Watchman: version: 2023.07.24.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.11.3 path: /Users/adarshjaiswal/.rvm/gems/ruby-2.7.5/bin/pod SDKs: iOS SDK: Not Found Android SDK: API Levels:
Issue and Reproduction Steps
The upgrade helper link state that (https://react-native-community.github.io/upgrade-helper/?from=0.67.5&to=0.72.3) We should change
AppDelegate.m
toAppDelegate.mm
.I want to know shall we just change the
.m
to.mm
and it will work (which I feel is not the case) or We should create a new file. If we need to create the new one how we are going to handle the existing code that we have inside the AppDelegate.m file (I am not much aware of ios development)?For me here is the AppDelgate.m file:
In case I just delete my AppDelegate.m file completely and add AppDelegate.mm that is mentioned inside the upgrade helper link, I get the error
9 Duplicate symbols for architecture x86_64
project.pbxproj
in the upgrade helper link, assuming that it will be autogenerated while building project. (Am I correct here?)