Error after changing app name

I’ve changed the app name in Xcode from app, and now i get an error when i run sync. I changed it in the file inspector, and accepted the recommended Xcode changes, and i also changed the name from app in the pod file. Has anyone else seen this, is the only problem i’ve encountered with Capacitor so far, i’m loving it way more than cordova.

thanks

✖ Updating iOS native dependencies with "pod install" (may take several minutes): 
✖ update ios: 
[error] Error running update: Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 5 dependencies from the Podfile and 32 total pods installed.
xcodebuild: error: 'App.xcodeproj' does not exist.

My guess is that changing the app name should be done in the capacitor.config.json file, not directly in Xcode.

Unless you made some other changes directly to the Xcode project that you need to preserve, the easiest way to fix your project is probably to delete the whole ios folder, and recreate it again by running npx cap add ios.

i changed it in there. I deleted the whole project and added it again, it’s fine until i change the app name, but i need to do that as i can’t leave it as app.

Perhaps you’re referring to the folder name? That’s always App, but it doesn’t really matter, not sure why you need to change it.

The appName configured in capacitor.config.json is what is used as the Display Name in the Xcode project configuration, and that’s what will be shown to the user when they install the app.

no, i haven’t changed the folder name.

I created the new capacitor app following the instructions in the 2.0 blog post. it all works fine, and syncs as long as the app name in Xcode is called app. When i change the name of the project in Xcode that’s when the problems start. the project name in the config file is the new one too, which is why i’m at a loss. I’ve also changed the reference name in the pod file

cheers

I’m still not clear why you need to change it though?

I get errors in iTunes connect if the name doesn’t match the previous bundle names

1 Like

The Bundle Identifier visible in the Xcode project configuration is called appId in capacitor.config.json. If you set that correctly at the beginning I don’t think you need to change the project name in Xcode.

Has anyone figured out what is causing the problem? I am also facing the same problem.

Any news on this issue? I have the same problem

I’ve left it in the end - I thought it affected the app name in the build but it doesn’t, so I just iet it be

1: Delete you ios folder
2: then again add ios using this cmd
npx cap add ios
3: then follow the capacitor official doc that ask you to
two steps
=> Edit pods file like this


=> Rename the App in target section Check this

Documentation


then it will not throw any error work perfectly

Finally I could find the solution. Open this file within your project

node_modules/@capacitor/cli/dist/ios/update.js

Then look for App.xcodeproj and change it to .xcodeproj

At my installation it was line #62 and looked like this

await common_2.runCommand(cd “{config.app.rootDir}" && cd "{config.ios.name}” && cd "{projectName}" && {installCommand} && xcodebuild -project App.xcodeproj clean);

3 Likes

Cos having a recent file list in Xcode that says:

App
App
App

is not terribly helpful!

1 Like

After changing the app name , please try to remove the platform and add again. It might works.

Currently of May, 2023 it is located in node_modules/@capacitor/cli/dist/config.js

line: 217
const nativeXcodeProjDir = ${nativeProjectDir}/**App**.xcodeproj;

Change it to what you need and solve the problem.

1 Like

Thank you! This should be promoted to the top. For me, it was line 216.