哪里是配置APP名称的正确位置?

问题描述 投票:0回答:2

每个Ionic项目都有一个项目配置文件 ionic.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",
  ...
}

哪里是应用程序名称的正确位置?

先谢谢你

ionic-framework ionic4 capacitor
2个回答
1
投票

Capacitor适用于任何框架,而不仅仅是Ionic,所以应用程序的名称应该是在 capacitor.config.json.

但正如你所说的,Capacitor秉承了 "一次编码,处处配置 "的理念,所以说 appName 只有在添加ios或android平台时才会使用,一旦添加了这些平台,你就必须将名称从Xcode改为iOS应用,或者从Android Studio改为Android应用。


0
投票

使用Cordova的 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="[email protected]" href="https://www.myserver.com">Author's name</author>
    ...
</widget>

更多信息。https:/cordova.apache.orgdocsenlatestconfig_ref)。

© www.soinside.com 2019 - 2024. All rights reserved.