2017-09-28 83 views
2

我使用GitLab CI自動爲Android和iOS構建應用程序。我的命令行構建適用於iOS不斷與錯誤而失敗:代碼簽名錯誤:SDK'iOS 11.0'中的產品類型'Application'需要代碼簽名。

Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.0'

我現在用的是master分支從cordova-ios GitHub上。由於這具有以下修補程序,就像這裏說:After upgrading to xcode 9, cordova app won't build, error 70, requires provisioning profile

在我build.json我使用以下設置:

{ 
    "android": { 
     "debug": { 
      "keystore": "config/android.keystore", 
      "storePassword": "<pass>", 
      "alias": "debug", 
      "password" : "<pass>", 
      "keystoreType": "" 
     }, 
     "release": { 
      "keystore": "config/android.keystore", 
      "storePassword": "<pass>", 
      "alias": "release", 
      "password" : "<pass>", 
      "keystoreType": "" 
     } 
    }, 
    "ios": { 
     "debug": { 
      "codeSignIdentity": "iPhone Developer", 
      "developmentTeam": "<team id>", 
      "packageType": "development", 
      "buildFlag": [ 
       "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES", 
       "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO", 
       "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\"" 
      ], 
      "iCloudContainerEnvironment": "Development" 
     }, 
     "release": { 
      "codeSignIdentity": "iPhone Developer", 
      "developmentTeam": "<team id>", 
      "packageType": "app-store", 
      "buildFlag": [ 
       "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES", 
       "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO", 
       "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\"" 
      ], 
      "iCloudContainerEnvironment": "Production" 
     } 
    } 
} 

我使用iCloudContainerEnvironment因爲我需要推啓用。我使用正確的配置文件開始構建過程。我使用CLI參數來做這件事,因爲我爲幾個不同的應用程序IDS構建應用程序:cordova build ios --device --provisioningProfile=<uuid>

但無論我做什麼或嘗試它都不會簽署應用程序並一直拋出錯誤。

編輯:

基於@Jerry霍頓建議我增加了供應配置文件到build.json文件。我試着用配置文件名稱和配置文件UUID。這兩種情況下會引發以下錯誤,並沒有exportOptions.plist是在platforms/ios/目錄中找到:

Code Signing Error: Provisioning profile "iOS Team Provisioning Profile: nl.XXX.loc.app" is Xcode managed, but signing settings require a manually managed profile.

我甚至去掉所有的插件,以確保沒有人站在道路。所以我build.json現在看起來是這樣的:

{ 
    "android": { 
     "debug": { 
      "keystore": "config/android.keystore", 
      "storePassword": "<pass>", 
      "alias": "debug", 
      "password" : "<pass>", 
      "keystoreType": "" 
     }, 
     "release": { 
      "keystore": "config/android.keystore", 
      "storePassword": "<pass>", 
      "alias": "release", 
      "password" : "<pass>", 
      "keystoreType": "" 
     } 
    }, 
    "ios": { 
     "debug": { 
      "codeSignIdentity": "iPhone Developer", 
      "developmentTeam": "<team id>", 
      "provisioningProfile": "<nl.XXX.loc.app or UUID>", 
      "packageType": "development", 
      "buildFlag": [ 
       "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES", 
       "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO", 
       "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\"" 
      ], 
      "iCloudContainerEnvironment": "Development" 
     }, 
     "release": { 
      "codeSignIdentity": "iPhone Developer", 
      "developmentTeam": "<team id>", 
      "packageType": "app-store", 
      "provisioningProfile": "<nl.XXX.app or UUID>", 
      "buildFlag": [ 
       "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES", 
       "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO", 
       "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\"" 
      ], 
      "iCloudContainerEnvironment": "Production" 
     } 
    } 
} 

ExportOptions.plist:

當我手動開運Xcode和創建調試存檔/導出手動我得到一個IPA和此文件夾中有是ExportOptions.plist,像這樣:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
<plist version="1.0"> 
<dict> 
    <key>compileBitcode</key> 
    <false/> 
    <key>method</key> 
    <string>development</string> 
    <key>provisioningProfiles</key> 
    <dict> 
      <key>nl.XXX.loc.app</key> 
      <string>nl.XXX.loc.app</string> 
    </dict> 
    <key>signingCertificate</key> 
    <string>iPhone Developer</string> 
    <key>signingStyle</key> 
    <string>manual</string> 
    <key>stripSwiftSymbols</key> 
    <true/> 
    <key>teamID</key> 
    <string>TEAMID</string> 
    <key>thinning</key> 
    <string>&lt;none&gt;</string> 
</dict> 
</plist> 

我真的看不出這裏有什麼問題。也許稀疏的部分?

回答

1

您需要在build.json文件中指定供應配置文件,以便在Cordova構建階段期間正確生成exportOptions.plist文件。嘗試使用一種變體來查看它是否可行,然後您可能需要爲每個應用程序構建變體保留build.json的變體。這實際上是我在我們的項目中所做的。我們的grunt構建腳本在「cordova add platform」和「cordova build」之前將build-.json複製到build.json。

"provisioningProfile": "provisioning profile name or UUID" 

後,科爾多瓦建設運行命令,成功或失敗的exportOptions.plist @

cordova/app/platforms/ios/exportOptions.plist 

我發現它有助於審查這一作爲調試工具生成。

+0

仍然沒有運氣,我編輯了一些輸出的問題。感謝您的時間和幫助 –

+0

如果我執行命令'離子cordova build ios --debug'而不是'ionic cordova build ios --device',那麼構建會成功。但是,我沒有得到任何IPA文件或任何'exportOptions.plist'文件 –

+0

是的, - 設備選項構建.ipa安裝在iPhone上。從Xcode 9開始,設備構建需要exportOptions.plist包含一些新的必需字段。不幸的是,這個文件是在運行「cordova build」命令時動態創建的。如果您按照https://stackoverflow.com/questions/46344443/after-upgrading-to-xcode-9-cordova-app-wont-build-error-70-requires-provisio/46370957#46370957中所述填充字段每次都會工作。 –

相關問題