APP名称在哪里配置合适?

Geo*_*fer 3 ionic-framework ionic4 capacitor

每个 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": {
    ...
  }
}
Run Code Online (Sandbox Code Playgroud)

使用电容器为我们提供了另一个放置应用程序名称的机会:

{
  // 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",
  ...
}
Run Code Online (Sandbox Code Playgroud)

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

提前致谢

jce*_*ile 6

Capacitor 适用于任何框架,而不仅仅是 Ionic,因此应用程序名称应位于capacitor.config.json.

但正如你所说,Capacitor 拥抱“一次编码,到处配置”的理念,因此appName仅在添加 ios 或 android 平台时使用,一旦添加它们,你必须从 Xcode for iOS 应用程序或从适用于 Android 应用的 Android Studio。