Где правильное место для настройки имени приложения? - PullRequest
1 голос
/ 25 мая 2020

Каждый проект Ioni c имеет файл конфигурации проекта ioni c .config. json, в котором вы можете настроить удобочитаемое имя приложения:

{
  // The human-readable name of the app.
  "name": "My App",

  // The project type of the app. The CLI uses this value to determine which
  // commands and command options are available, what to output for help
  // documentation, and what to use for web asset builds and the dev server.
  "type": "angular",

  // The App ID for Ionic Appflow.
  "id": "abc123",

  // Configuration object for integrations such as Cordova and Capacitor.
  "integrations": {
    "cordova": {
      ...
    }
  },

  // Hook configuration--see the Hooks section below for details.
  "hooks": {
    ...
  }
}

Использование конденсатора дает нам еще одну возможность разместить имя приложения:

{
  // The package name for Android and the bundle identifier for iOS.
  "appId": "com.company.appname",

  // Your app's name.
  "appName": "Capacitor Kitchen Sink",

  // Sets the directory of your built web assets. This is the directory that will be
  // used to run your app in a native environment.
  "webDir": "www",

  // The JavaScript package manager to use, either npm or yarn.
  "npmClient": "npm",
  ...
}

Где правильное место для имени приложения?

Заранее спасибо

Ответы [ 2 ]

1 голос
/ 26 мая 2020

Capacitor работает с любой структурой, а не только с Ioni c, поэтому имя приложения должно быть в capacitor.config.json.

Но, как вы сказали, Capacitor принимает идею «Кодировать один раз, настраивать везде ", так что appName используется только при добавлении платформ ios или android, после того, как вы добавили их, вам нужно изменить имя из Xcode для приложений iOS или из Android Studio для Android приложений.

0 голосов
/ 25 мая 2020

Используйте config.xml Кордовы. Для этого у вас есть тег <name>MyAppName</name>. Это имя, которое наконец появится под значком.

<widget id="com.mycompany.myapppackage" version="0.0.1" versionCode="1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>My App's name</name>
    <description>A nice description of my app.</description>
    <author email="mymail@myserver.com" href="https://www.myserver.com">Author's name</author>
    ...
</widget>

Подробнее: https://cordova.apache.org/docs/en/latest/config_ref/

...