跳至主要內容
版本:v8

原生錯誤

程式碼簽署錯誤

Code Signing Error: Failed to create provisioning profile. The app ID "com.csform.ionic.yellow" cannot be registered to your development team. Change your bundle identifier to a unique string to try again. Code Signing Error: No profiles for 'com.csform.ionic.yellow' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.csform.ionic.yellow'. Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.1'

在 iOS 裝置上執行應用程式需要佈建描述檔。如果尚未建立佈建描述檔,請依照這些指示操作

  1. 設定套件 ID

    對於 Capacitor,開啟 capacitor.config.json 檔案並修改 appId 屬性。

    對於 Cordova,開啟 config.xml 檔案並修改根元素 <widget>id 屬性。如需更多資訊,請參閱Cordova 文件

  1. Xcode 中開啟專案。

    對於 Capacitor,執行以下命令以在 Xcode 中開啟應用程式

    $ ionic capacitor open ios

    對於 Cordova,開啟 Xcode。使用 檔案 » 開啟 並找到應用程式。開啟應用程式的 platforms/ios 目錄。

  1. 專案導覽器 中,選取專案根目錄以開啟專案編輯器。在 身分 區段下,確認設定的套件 ID 與套件識別碼相符。

    Xcode showing the Identity section for an iOS app with fields for Display Name, Bundle Identifier, Version, and Build.

  1. 在同一個專案編輯器中,在 簽署 區段下,確保已啟用 自動管理簽署 然後,選取一個開發團隊。給定一個開發團隊,Xcode 將嘗試自動準備佈建和簽署。

    Xcode showing the Signing section with &#39;Automatically manage signing&#39; enabled and a Development Team selected.

Xcode 建置錯誤 65

Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/ionitron/projects/my-project/platforms/ios/cordova/build-debug.xcconfig,-workspace,SC project.xcworkspace,-scheme,SC project,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone X,build,CONFIGURATION_BUILD_DIR=/Users/ionitron/projects/my-project/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/ionitron/projects/my-project/platforms/ios/build/sharedpch

此錯誤是來自 Xcode 的錯誤碼,可能是由佈建問題或過時的 cordova 相依性所引起。若要修正此錯誤,請先確保已使用上述指示產生佈建描述檔,然後嘗試從 Xcode 執行應用程式

如果這無法修正錯誤,請執行以下命令

rm -rf node_modules
rm -rf platform
npm i
ionic cordova platform add ios
ionic cordova prepare ios
ionic cordova build ios --prod

執行這些命令後,可以進行全新的建置。

Google Play Services 版本衝突

Error: more than one library with package name com.google.android.gms

此錯誤是由兩個不同的外掛程式嘗試使用不同版本的 Google Play Services 所引起。若要修正此問題,請確保您正在執行 cordova 版本 7.1.0 或更高版本,以及 cordova-android 6.3.0 或更高版本。若要安裝最新的 cordova,請執行

npm install cordova@latest

若要更新 cordova-android,請執行

cordova platform update android

現在可以更新依賴 Google Play Services 的外掛程式以使用相同的版本。例如,如果 pluginA 使用版本 11.0 而 pluginB 使用版本 15.0,則可以使用 config.xml 檔案中的以下程式碼片段將它們更新為使用相同的版本

<plugin name="pluginA" spec="npm">
<variable name="PLAY_SERVICES_VERSION" value="15.0.0"/>
</plugin>
<plugin name="pluginB" spec="npm">
<variable name="PLAY_SERVICES_VERSION" value="15.0.0" />
</plugin>