Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename platform "App" in ionic with capacitor

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).

like image 931
user3714967 Avatar asked Jul 03 '19 16:07

user3714967


People also ask

Which file do we use to rename an Ionic app?

The Ionic framework application name can be changed in the config. xml file, Go to your applications config. xml file and change the name in the tag that is responsible for your app name.


3 Answers

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.

like image 157
brianjohnhanna Avatar answered Oct 23 '22 12:10

brianjohnhanna


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

like image 9
rtpHarry Avatar answered Oct 23 '22 13:10

rtpHarry


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

like image 7
bittor poza Avatar answered Oct 23 '22 14:10

bittor poza