How to properly sign cordova app? - ios

ERROR ITMS-90174: "Missing Provisioning Profile - Apps must contain a provisioning profile in a file named embedded.mobileprovision."
This issue has been plaguing me for the last 3-4 days, I have tried resigning and I am using a build config that looks like this:
{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"provisioningProfile":"ID found in myapp.mobileprovision",
"developmentTeam": "VKUC8843LP",
"packageType": "development"
},
"release": {
"codeSignIdentity": "iPhone Developer",
"provisioningProfile":"ID found in myapp.mobileprovision",
"developmentTeam": "VKUC8843LP",
"packageType": "app-store"
}
}
}
I am using cordova and here's the commands I am running to build the app:
cordova build ios --release --buildConfig
cd platforms/ios
pushd "build"
mkdir ./Payload
cp -R "emulator/myapp.app" ./Payload
zip -qyr MyApp.ipa ./Payload
rm -r ./Payload
popd
Then I put it in the ApplicationLoader and everytime I send it off, I get the above message. I have a build.json inside /App (directory before www). When I open the XCode file and checking to sign it says:
Provisioning profile "myapp" doesn't include signing certificate "iPhone Distribution: DEv Name(MYID1234)".

This is a problem with the new XCode 10 build system, which Cordova is not (yet) compatible with. Previous versions of XCode were opt-in for the new build system, but as of XCode 10 it's opt out.
If you're using XCode to do your build, then just go to File > Workspace Settings and select "Legacy Build".
Here are more details from the Cordova team: https://github.com/apache/cordova-ios/issues/407

Related

Why do I get an error signing ionic-cordova ios app from the command line if it works perfectly in the gui version of xcode?

I'm trying to build an Ionic - Cordova iOs app from the command line (to use an azure devops build and deployment agent), but from the last updates (certificates, xcode, OS, etc), i have no success anymore.
After trying a lot of options, i'm some lost with xcode command line. A 'few updates' before, this command where working perfectly, so I don't know what are happening with the profiles and certificates.
This is the command lines that I'm using:
security unlock-keychain -p **** [keychainpath]
ionic build --prod
ionic cordova build ios --no-build --release --device --provisioningProfile="*****" -- --buildFlag="-UseModernBuildSystem=0" --developmentTeam=***** --codeSignIdentity="iPhone Developer" --packageType=app-store
And this this is the result (I omitting all the log before the "archive succeded"):
** ARCHIVE SUCCEEDED **
2019-11-15 08:01:36.413 xcodebuild[32327:470732] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/jg/06xlqgms5n54qgh0mcj3tkvw0000gp/T/******_2019-11-15_08-01-36.412.xcdistributionlogs'.
error: exportArchive: No profiles for '*********' were found
Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for '*****' were found" UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription=No profiles for '******' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS App Store provisioning profiles matching '******'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.}
** EXPORT FAILED **
(node:31915) UnhandledPromiseRejectionWarning: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,*******.xcarchive,-exportOptionsPlist,/Users/*****/*****/_work/1/s/platforms/ios/exportOptions.plist,-exportPath,/Users/*****/*****/_work/1/s/platforms/ios/build/device
(node:31915) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:31915) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I have tryied to build the app with the GUI of XCode (and the same user) without problems, so I guess that certificates and provisioning profiles there must be allright.
Any clue on what are happening with the command line?
I finally found the answer: It was a bad combination of distribution profile and development profile parameters.
I found it using the --verbose mode in cordova build
I changed the way to define the parameters to build the ios package using a "build.json" definition file:
build.json
{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "*******",
"packageType: development,
"provisioningProfile": "*******"
},
"release": {
"codeSignIdentity": "iPhone Distribution",
"developmentTeam": "******",
"packageType": "app-store",
"provisioningProfile": "*******"
}
}
}
Which can used with the command line as follows:
ionic cordova build ios --no-build --prod --release --device --buildConfig build.json
Thanks to this I was able to see where the problem was and finally a was able to get the ipa file well signed.

Remotebuilderror with visual studio + cordova (error code 65)

I am trying to build (remotebuild) an IOs App with Visual Studio 2017 (Cordova) on Windows 10 but getting a build error: "Build failed with error Error Code 65 for command: xcodebild with args".
When I take a closer look at the build.log file on my Mac it shows me a Code signing error:
Code Signing Error:
[Application] requires a provisioning profile. Select a provisioning profile for the "Release" build configuration in the project editor. Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.3'
I've already created an provisioning Profile manually via https://developer.apple.com/account/ios/profile/create but how can I include that file in my build configurations, if I am not building the application with Xcode directly.
You'll need to include the details in your build.json file, something like this:
"ios": {
"debug": {
"packageType": "development",
"developmentTeam": "YOUR_DEV_TEAM_ID",
"codeSignIdentity": "iPhone Developer",
"provisioningProfile": "PROVISIONING_PROFILE_UUID"
},
"release": {
"developmentTeam": "YOUR_DEV_TEAM_ID",
"codeSignIdentity": "iPhone Developer",
"provisioningProfile": "PROVISIONING_PROFILE_UUID",
"packageType": "enterprise"
}
}
Check that the app id that you used to create your provisioning profile matches the id that's specified at the top of your config.xml file.
Add --buildFlag="-UseModernBuildSystem=0" to your build.json file.

No 'teamID' specified and no team ID found in the archive in ionic

Working in Ionic 2, then upgrading to 3 to try to fix this error. It began when I was trying to figure out a cordova plugin. The archive doesnt appear to be signed correctly.
** ARCHIVE SUCCEEDED **
2017-10-03 14:40:10.745 xcodebuild[4293:73077] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/12/9djblkvn1_7g0_41crqy9ht00000gn/T/Omnidispatch_2017-10-03_14-40-10.744.xcdistributionlogs'.
2017-10-03 14:40:10.965 xcodebuild[4293:73077] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fa1dde9d300>: Error Domain=IDEFoundationErrorDomain Code=1 "No 'teamID' specified and no team ID found in the archive" UserInfo={NSLocalizedDescription=No 'teamID' specified and no team ID found in the archive}
error: exportArchive: No 'teamID' specified and no team ID found in the archive
Error Domain=IDEFoundationErrorDomain Code=1 "No 'teamID' specified and no team ID found in the archive" UserInfo={NSLocalizedDescription=No 'teamID' specified and no team ID found in the archive}
** EXPORT FAILED **
Error: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,Omnidispatch.xcarchive,-exportOptionsPlist,/Developer/omnisolutions/omni-ionic/platforms/ios/exportOptions.plist,-exportPath,/Developer/omnisolutions/omni-ionic/platforms/ios/build/device
There have been a few solutions that suggest that its not the team id, but rather a certificate error. I'm not very good with mac certificates, but they seem to be in place and I've not changed them since this broke.
I have gone into xcode a time or two and the team was not saved, I've fixed that every time I've seen it and it seems to be staying there now, but its still not changing anything when i run ionic build ios
What else can I check?
I should add, that it builds in xcode 8, but not in vscode or on the commandline as it did previously.
I faced the same issue during a ionic cordova build without signature (for
pro MDM):
ionic build ios --release --device
--buildFlag="-UseModernBuildSystem=0"
finally I smash it using a build.json at the root folder with only the developmentTeam Info filled
{
"ios": {
"debug": {
"codeSignIdentity": "Apple Development: BLa BLa (XXXXXXX)",
"provisioningProfile": "<XXXXXX-XXXXXX-XXXXX>",
"provisioningProfileFile": "embedded.mobileprovision",
"certificateFile": "blabla.p12",
"developmentTeam": "<TEAMID>"
},
"release": {
"codeSignIdentity": "",
"provisioningProfile": "",
"provisioningProfileFile": "",
"certificateFile": "",
"developmentTeam": "<TEAMID>"
}
}
}
Hope it's help you
Unfortunately I did not find a great solution for this error. I was forced to rm -rf my directory, uninstall ionic and cordova and bring it all down from git and set it up again.

How to automatically set the Signing Team on IOS cordova project?

I am trying to automate the build/deployment of my hybdrid mobile application in Jenkins using fastlane.
I use ionic (v3.3.0) and cordova (v7.0.1) for the source. I use fastlane v2.36.0 and Xcode is version 8.3.2.
The command I run in the jenkins job
yarn
ionic cordova prepare
fastlane ios build
The fastlane/FastFile
platform :ios do
before_all do
end
ios_project_path = "platforms/ios/awesomeproject.xcodeproj"
desc "Build for IOS"
lane :build do
increment_build_number(
xcodeproj: ios_project_path,
build_number: ENV["BUILD_NUMBER"]
)
# Recreate schemes to ensure a smooth transition from cordova to gym
recreate_schemes(project: ios_project_path)
update_project_team(
path: ios_project_path,
teamid: "TEAMID"
)
#update_provisioning_profile_specifier(xcodeproj: ios_project_path)
gym(scheme: "awesomeproject",
configuration: "Debug",
clean: true,
project: ios_project_path,
output_directory: "target")
end
end
The fastlane/Appfile
package_name "com.xxx.awesomeapp"
app_identifier "com.xxx.awesomeapp" # The bundle identifier of your app
apple_id "xxx.xxxx#xxx.com" # Your Apple email address
team_id "TEAMID" # Developer Portal Team ID
The command fastlane ios build is failing on the gym instruction with the error
Code signing is required for product type 'Application' in SDK 'iOS
10.3'
The detailed error in the fastlane log is
Check dependencies Signing for "awesomeproject" requires a development
team. Select a development team in the project editor. Code signing is
required for product type 'Application' in SDK 'iOS
10.3'
The xcode project generated by Cordova has the Automatic signing activated but it is missing the Signing Team.
The workaround I used so far is to manually select the Team with Xcode the first time the platform/ios folder is generated. But if I remove the platform folder generated by cordova, I need to redo the selection of the team in XCode.
Is there a way to select with Cordova or any fastlane plugin the Signing team? I am open to use any solution, script.
So my build will be fully automated. The update_project_team instruction is not working.
Create a file called build.json in the root directory of your project, with the Team ID and provisioning profile GUID you want to use to sign the app:
build.json:
{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"provisioningProfile": "{your development profile}",
"developmentTeam": "{your Team ID}",
"packageType": "development"
},
"release": {
"codeSignIdentity": "iPhone Distribution",
"provisioningProfile": "{your distribution profile}",
"developmentTeam": "{your Team ID}",
"packageType": "app-store"
}
}
}
Then, when you build using the Cordova CLI, these signing credentials will be used.
Note: according to the Cordova documentation the above syntax is deprecated for Xcode 8 and iOS 10, and the provisioning profile GUID is no longer needed. However, I've been unable to get it working without specifying the provisioning profile using Cordova v7.0.1.

Missing Build.json file in Cordova App

I am trying to run my Ionic Cordova Mobile App on an iPhone from Visual Studio using remotebuild remote device on a Mac.
The issue I am facing is that my Visual Studio project is missing a build.json file which I have since created and entered the following:
{
"ios": {
"debug": {
"developmentTeam": "XXXXX"
},
"release": {
"developmentTeam": "XXXXX",
"codeSignIdentity": "iPhone Developer"
}
}
}
I keep receiving the following error:
Error:Remote build error from the build server Build failed with error Unexpected token in JSON at position 0 -1
I am using XCode 8 and Cordova CLI 6.2.0
Any advice as to what I am doing wrong?

Resources