Renaming a React Native project - ios

I have a working react native app (without expo), running and compiling in both Android and iOS devices. Now I'm trying to rename the app, but I'm having problems with that.
Steps followed:
I have deleted both ios and android directories.
Changed the project name in my app.json
Regenerated the android and ios directories with react-native upgrade --legacy (cause eject is not working anymore)
Updated my podfile with the need
Pod install
When i tried to compile my app via xcode, I got "null is not an object (evaluating '_RNGestureHandlerModule.default.Direction')
I guessed that was due to the autolinking when you install some react native third party components. So I deleted node_modules, and installed all react native navigation again. Then I ran react-native link. The previous error went away.
Now, I'm stuck with:
Target 'cjlrnneTests' has target dependency on Target 'cjlrnne'
That command depends on command in Target 'cjlrnne': script phase “[CP] Copy Pods Resources”
Honestly, I don't know what else more to do / look for.
Can anyone please provide with some clue, or the steps to change a RN app's name?
Thanks!

You can try this package for renaming the app.
react-native-rename
https://www.npmjs.com/package/react-native-rename
react-native-rename <newName>
It will automatically configure all the things.

Related

importing "Module 'app_settings'" not found

I'm currently trying to work with xcode to test my flutter application with xcode. The big issue is that all of my imports (such as app_settings, cloud_firestore, etc...) give an error for "Module ___ not found". When I try to run my dart code I get the error in the terminal:
[Proj Root]/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'app_settings' not found
#import app_settings;
~~~~~~~~^~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
I tried running flutter create for ios, (this might've made things worse?) Flutter clean and reinstalling pods doesn't seem to work either. I'm wondering if there's something simple that I missed with importing modules. I created the application on android using modules that should work with Android & iOS. After getting the android version working I pulled my project on my mac through github and finally reached this issue. Any pointers would be appreciated because I'm totally stuck on this.
My project has 3 build flavor. Development, Staging & Production.
In Xcode It was selected default Runner One. (On Top of the middle)
though i follow the process like
delete pod , Podfile.lock and .symlinks from Android Studio / (From Project)
flutter pub get
cd ios > pod install
Then In XCode > clean build
Select Right Build Flavor (Production For Me)
Then Archive (Done)
NB: I tested in M1 machine.
Hmm Not sure what happened but it seems to be good now. I think pod init was initializing minimal data for the podfile. Instead, I deleted the Pods file and did flutter run and it built the podfile correctly with flutter pub get.
Had the same problem, we solved it by setting the iOS Deployment target in XCode to the same value as set in the Podfile, which was 12.0. Then ran flutter clean and flutter build ios worked like a charm 🎉
I had this same problem. What I did was
Delete the Podfile and Podfile.lock
flutter clean
flutter build ios
Opened the Runner.xcworkspace
Build on Xcode
This worked for me 🎉
Delete pod directory and podfile.lock
flutter clean
flutter pub get
cd ios
pod install --repo-update
run the application in Xcode
I tried everything above, but for me the solution was quite different.
I am using flavors (schemes), and I accidentally created the scheme with upper case in the first character, while everywhere else (build config etc.) I used lower cases only. After deleting the scheme and recreating with lower case characters, it worked.
path/flutter/ios/Runner/GeneratedPluginRegistrant.m:12:9: Module 'app_settings' not found
I had the same issue after upgrading the Xcode to 13.3 and my production build flavor wasn't working. I was using firebase as well. In my production build flavor, I didn't append anything to the configuration name (i.e. all the other configurations have the name like "Debug-staging", "Debug-development", but in the production, it's only "Debug"). I just deleted the pod file and run:
flutter run --flavor production --target lib/main_production.dart
Everything worked fine for me.

Installing react-native-custom-segmented control, need to install ios framework to react-native project

I'm trying to install this: https://github.com/wix/react-native-custom-segmented-control into my react-native project.
In the installation instructions, it says to move the .xcodeproj file to my project folder. I dragged it to the root folder of my project (though I am not sure that is right).
Then the instructions say to add the libCustomSegmentedControl.a file to my target's library.
The project was initialized using expo and I don't think it has a xcode target project? I am confused as to how to proceed in installing this. Is there a secret place in a react-native app that I can find the xcode project?
I'm a beginner with ios so any help would be really appreciated!
If you created the project using expo then you need to eject it before you can install any module that expo doesn’t support.
You can find more info at this link.
https://docs.expo.io/versions/latest/expokit/eject
Expo doesn’t actually have an Xcode or Android project inside the code base, so you can’t add react-native-custom-segmented-control to an expo project.
This post does a good breakdown of the differences between creating a react-native project using expo or react-native init
https://stackoverflow.com/a/49324689/5508175

Can't build Cordova iOS project using CLI but can build/run the Xcode project

Absolutely new to Cordova. These are the steps I've done:
Checked out an existing project
run cordova build ios
The above generates this build error:
(node:10242) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. (The platform "ios" does not appear to be a valid cordova platform. It is missing API.js. ios not supported.)
I've Googled for a solution to the above and the general consensus seems to be to remove and then add the iOS platform.
Now there's a problem with that. Looking through the commit history, I can see that there have been code changes done to files within the platforms directory so I can't just remove it, or...
Question 1)
Can I?
Question 2)
Is it right to make code changes within the platforms directory? Because it seems like those are generated directories.
Question 3)
Why is it that when I open the Xcode project under platforms/ios, I am able to build/run it fine despite the Cordova CLI error above?
it's not right to manually edit the platform files. And some manual changes might make the project not build, so might be related to the manual changes somebody did. So if you don't want to risk to remove the platform, continue building from Xcode
from root www to platforms/ios is transferred by cordova commands such us cordova prepare ios or cordova build ios or cordova run ios.
So if you can't do a cordova prepare ios because of that error you can try a few things.
Copy your files from www to platforms/ios without replacing the whole folder, just the duplicate files. cordova prepare ios is not just a copy, it's also does some modifications/aditions, but if you don't remove existing files it might work.
Create a new project and copy the platforms/ios/cordova to your own project and see if that fixes the mentioned problem, as that's where the Api.js file is.
Downgrade the Cordova CLI, try to latest 7.x.x and if it doesn't work, try with latest 6.x.x, one of those won't require the Api.js as it relatively new.

React-Native: Build error GeneratedInfoPlistDotEnv.h file not found

I had a old React-Native project which I wanted to give it a try again and when trying to run the project on iOS (Android works perfect) I get the error that Debug-iphonesimulator/GeneratedInfoPlistDotEnv.h file not found.
If I run the project from the command react-native run-ios, than the build will succeed.
What can cause this issue and how can it be fixed?
I have tried to fix it with the comments from this issue but no success.
React-Native verision: 0.47
Full error:
<built-in>:1:10: fatal error:
'/Users/myUser/Library/Developer/Xcode/DerivedData/Project-gcaxrvbcwgkfhkadevoqxcprxszw/Build/Products/Debug-iphonesimulator/GeneratedInfoPlistDotEnv.h' file not found
I fixed by copying file GeneratedInfoPlistDotEnv.h (in /ios/build/Build/Products/) to the path mentioned in the error message.
The path mentioned in error message for simulator is not same as real phone, you need to copy for a second time.
The development for React Native just like droped in a deep black hole, what you need to do is just climb and climb and climb...
Changing the Info.plist preprocessor prefix file to works for me ${CONFIGURATION_BUILD_DIR}/../GeneratedInfoPlistDotEnv.h
Image of code in Xcode 9
If you're coming from React version 0.60 and above, you should be referencing the package from GitHub instead of NPM. The author hasn't released auto-linking support on NPM yet, even though it's already merged!?
Try these steps after you unlink and uninstall the existing version of react-native-config. Remember to revert to default Info.plist preprocessor settings in XCode build settings.
yarn add https://github.com/luggit/react-native-config.git
cd ios && pod install
You don't have to add any other post-install scripts, just run the app like usual and it should work fine. Make sure you undo any other fixes before doing this.

Why does my xcode project build on simulator but not device in xcode project?

I have a react native project that runs successfully on simulator but not on device.
I have run the project on the same device before, but not since I've incorporated cocoapods, though none of the above library are in cocoapods. I'm building in xcworkspace rather than a project file, not sure if that is it.
Not sure what this could be... Any suggestions appreciated!
Usually these type of errors appear when the libraries are not linked with the project.
The libraries might have been unlinked after adding cocoapods. Try running npm install and then react-native link to link all the libraries or run react-native link <library-name> to link the specific library in the terminal from your project root directory.

Resources