How to rename platform "App" in ionic with capacitor
Asked Answered
G

6

12

How to rename platform application name from "App" to something else?

When adding platform to ionic capacitor project by npx cap add ios it generates ios/App folder but I would like to name it ios/my-app.

And if it is possible I would like to add two apps for the same project for different environments (ios/my-app-test and ios/my-app-prod).

Gangrene answered 3/7, 2019 at 16:27 Comment(0)
B
11

This is actually now addressed in the documentation here: https://capacitor.ionicframework.com/docs/ios/configuration/#renaming-the-application-s-default-app-name

You can't rename the App folder, but you can set the name of your app by renaming the "target" called "App".

  1. In Xcode, click on the name of the target twice to edit the name.
  2. Update the Podfile where it says 'App' to the new target name.
target 'App' do # <- change 'App' to 'Your App Name'
  capacitor_pods
  # Add your Pods here
end
  1. Restart Xcode to see the change fully reflected.

Don't try and change the name of the project itself or things can start to break... Just leave as App. The strategy by @bittor poza caused similar issues so make sure to only change the Target name.

Bentinck answered 22/6, 2020 at 20:38 Comment(0)
J
10

From looking into this it seems the answer is no to both of your questions.

The IOS template comes from here:

https://github.com/ionic-team/capacitor/tree/master/ios-template

Which has the /App/ folder set without any configuration options.

The command starts here:

https://github.com/ionic-team/capacitor/blob/master/cli/src/tasks/add.ts

Then hands off to this file for ios:

https://github.com/ionic-team/capacitor/blob/master/cli/src/ios/add.ts

And all of the settings are put together here:

https://github.com/ionic-team/capacitor/blob/master/cli/src/config.ts#L182

Which shows that it just pulls in the template dir, with no option to configure any renaming of the subfolders within it:

https://github.com/ionic-team/capacitor/blob/master/cli/src/ios/add.ts#L17

Jaymejaymee answered 6/7, 2019 at 10:6 Comment(1)
how insightful!Leishaleishmania
H
7

I have changed the name of the project in two simple steps.

  1. Select the name of the project.
  2. Enter the new name in the menu on the right.

steps

Official Xcode documentation

Edit: The proper way to avoid future problems when updating Capacitor is to follow the official documentation. Renaming the application's default App name
Example: Example

Holder answered 24/2, 2020 at 11:40 Comment(0)
A
3

You can't rename the App folder, what you can do is to add targets to the native project.

Just right click the existing "App" target and choose duplicate. You can also rename the existing target if you click on the "App" text.

But if you add new targets, or rename the existing one, you have to also modify the Podfile to add the new targets or to rename the current target accordingly.

Artistic answered 18/7, 2019 at 14:36 Comment(0)
O
2

As of 2023, all of the previous solutions seems to either not work well, or give problems. I'm not saying that this solution is the absolute best, but I've found this out when I was looking at all of these solutions while having this problem.

Change the iOS app display name

You can change the app display name that shows up on the app by following these steps

  1. Click on the App project folder

  2. Go to the Targets Area (Usually would be named App, but my isn't because I've manually changed the name)

  3. Go to the info tab

  4. Go to Bundle display name and change the value. This value will be the same value that will be displayed as the name on the iOS app so don't use too many letters.

Opec answered 8/1, 2023 at 9:59 Comment(0)
R
1

Here is the solution after trying multiple time you just have to follow the capacitor documentation

1: Delete you ios folder

2: then again add ios using this cmd

npx cap add ios

3: then follow the capacitor official documentation that ask you to do two steps.

=> Edit pods file like this

=> Rename the App in target section Check this image

Documentation

then it will not throw any error work perfectly

My Answer on ionic forms

Rationale answered 4/2, 2021 at 12:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.