I'm trying to build and archive my XCode project using following command:
xcodebuild -scheme MyApp -workspace MyApp.xcworkspace clean archive -archivePath build/MyApp
xcodebuild -configuration AdHoc -exportArchive -exportFormat ipa -archivePath "build/MyApp.xcarchive" -exportPath "build/MyApp.ipa" -exportProvisioningProfile "afe33cd1-5e6c-47a6-a315-bd442e43ad95"
It is building successfully but exporting ipa is failling with following error:
error: no provisioning profile matches 'afe33cd1-5e6c-47a6-a315-bd442e43ad95'
** EXPORT FAILED **
I have tried following as well
-exportProvisioningProfile "afe33cd1-5e6c-47a6-a315-bd442e43ad95.mobileprovision"
I'll appreciate any help in this regard. Thanks
Value of -exportProvisioningProfile should be the exact name of the provision profile in your system, you can copy this exact name from your developer portal also.
Here is how you can fix this:
Step 1)
Find the provisioning profile name:
/usr/libexec/PlistBuddy -c 'Print Name' /dev/stdin <<< $(security cms
-D -i {placeholder})
Replace the {{placeholder}} with absolute path of provisioning profile with profile name.
Example:
/Users/abc/Library/MobileDevice/Provisioning\ Profiles/49a23630-f766-4892-90f0-d9were00f2fc.mobileprovision)
Step 2)
Build ipa from app file
get the provisioning profile name and replace below {profileName}
replace {archiveFile} with the absolute path of .xcarchive file
replace {pathtosaveipa} with path where you want to save ipa
replace {codesigningName} with the certificate name associated with provisioning profile
execute below after replacing the placeholder with actual value
xcodebuild -exportProvisioningProfile "{profileName}" -exportArchive -exportFormat IPA -archivePath "{archiveFile}" -exportPath "{pathtosaveipa}/app.ipa" CODE_SIGN_IDENTITY="{codesigningName}"
Related
I have a problem with building (archiving) the workspace because whenever I run
xcodebuild archive -workspace app.xcworkspace/ -scheme app-scheme -configuration Production -derivedDataPath ./build -archivePath ./build/Products/app.xcarchive DEVELOPMENT_TEAM=AAABBBCCCD PROVISIONING_PROFILE_SPECIFIER="prod DistProf" CODE_SIGN_IDENTITY="iPhone Distribution"
I get
XXX does not support provisioning profiles. XXX does not support provisioning profiles, but provisioning profile YYY has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor.
for each pod.
When I omit the DEVELOPMENT_TEAM flag then I get
Signing for "myAPP" requires a development team. Select a development team in the build settings editor that matches the selected profile "YYY".
All the pods do not need signing. Specifying the flag in the command line seems to ignore the settings for different project. I can't use automatic signing as I am not a member of the team that issued the certificate, I only have cert and provisioning profile on my machine so any fastlane solutions won't work. Also I can't set it up once in the project as it comes from a 3rd party company and we can't share our profiles.
How can I set up this project to continuous integration chain?
I was having the same issue and found a working solution after much trial an error.
I couldn't get the command line approach to work, despite a claim to the contrary that i found on this Google group https://groups.google.com/forum/#!topic/cocoapods/q5x653je7MA
What worked for me was to stop specifying the team, provisioning and identity in the command line and instead move that to a xconfig file.
In the particular case of working with Cocoapods it goes like this:
Create the xconfig file. This is done by simply creating a new "Configuration Settings" file with Xcode (it's under 'Other' in the new file dialog). This file will be empty.
Fill in the values for code signing in the xconfig file. This can be done by first setting the values in xcode's build settings and then copy & pasting over. The resulting file looks something like this:
#include "Pods/Target Support Files/Pods-xxx/xxx.release.xcconfig"
//:configuration = Release
DEVELOPMENT_TEAM = xxx
//:configuration = Release
PROVISIONING_PROFILE_SPECIFIER = xxx/xxx
Replace xxx with the right values for your project. The PROVISIONING_PROFILE_SPECIFIER value is
a combination of the Team ID and profile name (as it is named in the
Developer Portal, not necessarily the actual filename)
as specified here https://possiblemobile.com/2016/06/code-signing-xcode-8/
Note that the first line is to include the release.xconfig generated by cocoapods. This is important! if you don't do this and run pod update, you will see a warning pop up asking you to do it or else nothing will work
Assing your project to use the xconfig file. This is done by going to the Project's General tab and scrolling to the Configurations setting. You can then select your newly created xconfig file from the dropdown under Release
(further information on how to use a xconfig file can be found here http://www.jontolof.com/cocoa/using-xcconfig-files-for-you-xcode-project/)
With all that in place, you can proceed to build the archive:
xcodebuild archive \
-workspace "xxx" \
-scheme "xxx" \
-sdk iphoneos \
-archivePath "xxx"
For my personal project, I am using Circle.ci to test and deploy the OSX application (with upload hook to S3, to distribute it outside the AppStore - using the signed with Developer ID distribution method). I am using FastLane to build the app, which works flawlessly when building it from my local terminal, but I cannot get past code signing step when using the CI server.
The issue is very simple, the keychain does not import the provision profile, which I can tell from the pre-build step:
1 key imported.
No provisioning profiles found in repository.
You must add a provisioning profile to your repository
to enable CircleCI code-signing support.
Currently installed Code-Signing identities:
Policy: Code Signing
Matching identities
0 identities found
Valid identities only
0 valid identities found
I have my .p12 with private key and certificate uploaded to the repository, no issue there. I have also added the .provisionprofile to the repository (root, even different locations) but to no avail. The documentation states (https://circleci.com/docs/ios-code-signing/) that there is a need for .mobileprovision, but that only covers the iOS, not the OSX, while the system should be nearly identical so I assumed that would work as well.
So the TLDR question is: How do I import the provisioning profile of the OSX distribution on the Circle.CI, so the keychain accepts the entry? Or is there a way around it - like skipping the signing step (disabling it in XCode) and signing it by hand with some .sh?
Thanks everyone!
I am sharing my experience of deploying iOS app to Testflight using CircleCI. Maybe this helps.
Put the provision profile file in the root of your project directory. Make sure it is a normal "Distribution Profile" not a App Store submission profile.
Just add the .p12 key in the project settings of CircleCI. Remove all other certificates / .p12 file from the repository.
I tried using fastlane to build and distribute the build but it was failing in CircleCI. I had these three steps in my Fastfile beta environment.
increment_build_number
gym(scheme: "mySchemeā€¯)
pilot
I changed that to just
increment_build_number
My Circle CI file
machine:
environment:
GYM_CODE_SIGNING_IDENTITY: "iPhone Distribution: Company Name (XXXXXX)"
xcode:
version: "8.0"
test:
override:
- set -o pipefail && xcodebuild -workspace 'my.xcworkspace' -scheme 'myscheme' clean build test -sdk iphonesimulator -destination 'id=AC291080-8EFE-4095-8C55-B1E952EFFC36' CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE=
dependencies:
pre:
- gem update fastlane
deployment:
beta_distribution:
branch: master
commands:
- fastlane beta
- gym --scheme "myscheme" --workspace "my.xcworkspace" --export_method app-store --use_legacy_build_api false
- pilot upload
Is there anyway to specify where to put the output file (ie .app) for xcodebuild? By default it is in:
/Users/myusername/Library/Developer/Xcode/DerivedData/Project-crkyjjbuqqnqqvfxehsjsarzlbbr/Build/Products/Release-iphoneos/Project.app
As I need to find the output Project.app file, if there is no way to specify the path, can I use a script to look for that "/Users/myusername/Library/Developer/Xcode/DerivedData/" folder and inside it find the one with latest modified date and prefix "Project-"? What does the script look like?
Thanks
Override the CONFIGURATION_BUILD_DIR environment variable in an xcodebuild argument. For instance, this command would put its build products under "/tmp/sportsball/":
xcodebuild -workspace Sportsball.xcworkspace -scheme "Sportsball Debug" -configuration Debug clean build CONFIGURATION_BUILD_DIR=/tmp/sportsball/
I'm setting up a CI system using Jenkins and was finding that the build was failing because xcodebuild reports there are no schemes when I was executing the line
-xcodebuild -workspace XXX -scheme NNN.
I couldn't figure out why this could be happening, so to eliminate something screwy being up with my workspace I created a new project template using XCode and found that I am getting a difference in behavior for any xcodebuild command and for any workspace/project.
The template project was called scrap and if from the terminal command line I run this command for example:
xcodebuild -list
It outputs
Information about project "scrap":
Targets:
scrap
Build Configurations:
Debug
Release
If no build configuration is specified and -scheme is not passed then "Release" is used.
Schemes:
scrap
But if I run xcodebuild -list from within Jenkins then the output instead is:
Building in workspace /Users/Shared/Jenkins/Home/workspace/scrap
[scrap] $ /bin/sh -xe /var/folders/ph/s6dvlfq9769741g_yzmjlmz000007c/T/hudson3765407964219991487.sh
+ xcodebuild -list
Information about project "scrap":
Targets:
scrap
Build Configurations:
Debug
Release
If no build configuration is specified and -scheme is not passed then "Release" is used.
This project contains no schemes.
This is the most simple of jenkins jobs - all I do is create a new job, set it to a free-style software project, then add a build step of Execut shell and add the xcodebuild -list command, that's it.
Why is xcodebuild saying there are no schemes when there are? And why is it behaving differently when run from within Jenkins?
Figured out that all you need to do is to set the scheme to be shared.
Scheme > Manage Schemes
Make sure "Shared" is checked.
This will then generate out a new folder/file .../xcshareddata/xcschemes/???.xcscheme
Check this file into your source control and scheme should now appear on your jenkins box.
you must ignore your .xcodeproj/xcuserdata/.xcuserdatad in your .gitignore file.
xcodebuild -list get schemes from .xcodeproj/xcuserdata/.xcuserdatad/xcschemes.
jenkins server has no this file so get no schemes,you can open *.xcodeproj in your jenkins server,it will create the file and then do xcodebuild -list can get the current schemes.I have the same problem and solved by the method above.
Yet another code sign error.
I'm running command:
xcodebuild -project $DIR/myproject.xcodeproj -sdk iphoneos5.0 -alltargets
and my project.pbxproj
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Ryan"
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "/Users/ryan/12345678-9012-3456-7890-123456789012.mobileprovision";
with output
=== BUILD NATIVE TARGET myproject OF PROJECT myproject WITH THE DEFAULT CONFIGURATION (Release) ===
Check dependencies
[BEROR]Code Sign error: Provisioning profile '/Users/ryan/12345678-9012-3456-7890-123456789012.mobileprovision' can't be found
I can't find any guidance on how to do this. Ive tried putting the provision in ~/Library/MobileDevice/Provisioning Profiles and setting the profile field in project.pbxproj to just the profile ID
It is a requirement that I need to be configure this at the command line w/o Jenkins/Hudson
Provisioning file goes to ~/Library/MobileDevice/Provisioning Profiles and you you can select the provisioning profile like this:
xcodebuild PROVISIONING_PROFILE=12345678-9012-3456-7890-123456789012