Azure Piplines Configuration for Xcode Managed Profile Setup - Possible? Documented? - ios

Environment
Server - Azure Pipelines
Hosted MacOS agent
Issue Description
I'm using the following configuration in my Xcode project (w automatic code signing):
Is it possible to have Pipelines build and sign a project using this configuration if I've manually installed all of the provisioning profiles and certs in my pipeline prior to building?
Is there any documentation for this scenario or a how-to guide? Alternatively, if this is not possible perhaps a definitive statement on this and advice on what to try next in order to work. For instance - do I need to convert this project from an automatically signed one to a manual one?
I'm using the following page which mentions automatic signing but doesn't give any instructions on how to configure (but does mention this as an option):
https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/mobile/app-signing?view=vsts&tabs=apple-install-during-build
Any help would be appreciated.
Thanks,
Andrew

To help anyone who comes across this later.
The issue in my case was that I have a solution with multiple targets (App, Widget, Siri Intent, and Siri UI). Each of these requires it's own provisioning profile and needs to be signed independently - this is where I ran into trouble (the default configuration seemed to try and apply the App profile to all Targets when signing).
To help anyone who struggles with this - in order to solve I needed the following steps in Xcode:
Convert the project to manual signing.
Archive and export in Xcode
'Distribute via App Store'
Select to Export but not submit and choose a location
Selected the desired provisioning profiles for the export.
After export head to saved location and grab 'exportOptions.Plist'.
Choose .plist for 'export options' in the appropriate DevOps
pipeline.
Voila you can sign your solution with multiple schemes!
Hope this helps someone.
Andrew
PS - At some moment I will confirm that setting everything back to automatic signing works with exportOptions.Plist and will report back.

Related

Xcode 8 A valid provisioning profile for this executable was not found

I know there are other questions asked like this here but I've followed all their solutions yet still end up with this error message.
I have a valid Apple Developer account with program active.
I have tried using managed and unmanaged provisioning with new/fresh bundle ID's (which get recreated provisioning profiles).
I have tried this: A valid provisioning profile for this executable was not found for debug mode
I have tried this: XCode :7 App installation failed :A valid provisioning profile for this executable was not found
I have deleted any old versions of the app from my phone.
I have confirmed my device ID on the developer portal is the same as in Xcode (was also useful for manual provisioning profile management to confirm)
I even tried another developer ID I have out of sheer desperation and yet the same error appears.
I even get this error when building for release scheme with my valid distribution certificate.
I've spent a ton of time trying to figure this out now I'm hoping someone else has felt my pain and actually solved this.
UPDATE: Adding screenshots for usefulness
UPDATE 2: I gave up trying to solve this problem, I created a new project and copied source files into the new project and I now have it working. Clearly something in the project configuration/settings files got corrupted somehow in the previous project which no obvious fix available. Will leave this question open, perhaps someone has a solution eventually. I have my old 'non-working' project so will continue to try those just for curiousities sake.
Before this error message, Build Succeeded is shown.
ATTENTION!
Who should read
If you were developing with a "Personal Team" and is switching to a paid team, then you'll get this error if you have not updated your other targets as well.
The cause
Since I'm using react-native, I happen to have a target for test (i.e. a target called appTests), and switching the team just in one target wasn't sufficient, and leads to this error. This error isn't informative enough to let you know there's an error in one of the targets, therefore leading to a long debugging time for myself.
Solution
1) On Xcode 9, go to every targets and update the team!
2) Unfortunately, the next steps aren't very reliable from my experience, you might have to do your best to clean the caches.
3) Stop every single running scheme/application by using the stop button
4) Go to Product -> Clean and cleans every schemes you use.
5) Quit and Restart Xcode
6) Run again and hopefully it works! If not, it's likely some cache are still present.
You can't install a build that was signed with the app store distribution provisioning profile and certificate (I'm assuming your release scheme is set to use your app store cert and profile). It will fail to install on the device if you try. You need to use either a development profile, or an enterprise distribution profile to install on test devices. The iOS Distribution certificate can only be used to build an app that will be installed via the App Store.
Thats a conflict of Xcode. The way I solved it is by deleting the derived data of Xcode.
Xcode > Preferences > Locations
You will see an arrow right from the path of the DerivedData which will open them in finder. Just erase everything in the folder.
Update: According to Chandler's comment check if there is a need to delete the test target.
I solved it by changing the build system to legacy in Xcode 10
File > Workspace Settings > Set Build system to "Legacy Build System"
It works when I also add the correct signing for myProjectTests. This was the last thing I did after trying all sort of solutions for 5 hours.
I followed many proposals but it didn't work until I unchecked Automatic signing for the TESTS
Clearing the DEVELOPMENT_TEAM and DevelopmentTeam entries in the xcodeproj/project.pbxproj file worked for me.
I'm on 8.2.1 and just had this same error. Deleting the original project folder and recreating it worked seamlessly. I verified that all of the signing and provisioning certificates were exactly the same as the last project. I'm not sure where the issue lies, but I believe your assumption of corrupted files is accurate.
In my case it was a conflict with the development team.
I've solved by opening my xcodeproj/project.pbxproj and emptying the following variables:
DevelopmentTeam
DEVELOPMENT_TEAM
We had a similar issue: we deleted the Unit Tests and it worked.
In my case, it was the problem when I setup my time manually two month earlier on my iPhone. But when I changed to set time automatically, it worked fine.
Setting -> General -> Date & Time -> set time automatically
GOTO: Targets->yourProjectNameTest and verify that team is the same as on yourProjectName
I had this problem too, and for me the solution was to sign in to https://developer.apple.com. There was a red bar, going like "our TOS have changed, you have to accept them again", I did, and then my provisioning profiles worked again immediately.
An easier fix is to uncheck the test target as part of the Analyze & Run steps in Edit Scheme > Build -> Build.
This is very specific to React Native projects, since this is how the projects are configured by default.
In my case it worked for me to follow the instructions in this article. Then disable Automatically manage signing inside xcode in the general tab.
Automatically manage signing disabled
And finally provide manually Provisioning Profile for Signing (Debug) and Signing (Release)
Note: The Provisioning Profile you must generate it from Apple Developer Program website, in the section Certificates, Identifiers & Profiles -> Provisioning Profiles
I hope you find it useful. regards
Step to be followed
must have a developer account - https://developer.apple.com
create a certificate for development
Add devices with UDID
add provisioning profile in development
sign in Xcode with your account
clean build
Build with any destination choose device I have done for iphone 6
the archive will be disabled first, the archive will be active by choosing
generic ios device from the right corner of Xcode for example ->
yourAppName>generic ios device
once archive is done build for development not ADHOC
done
I fixed it by setting in main Target / Build Settings / Section Signing
Code signing Identity: Debug and Release set to IOS Developer
Code Signing Style: Automatic
Provision Profile: all automatic.
I set this exactly same for Test Target.
Then i was able to run release version on my phone. Btw i dont know what is the difference between IOS Developer and iOS Distriobution though.
I had edited my app scheme Build Configuration from Debug to Release, and unchecked the Debug Executable.
I am not sure why, but if it makes a difference my signing details for Debug and Release were different. So after I reset those back to Debug and checked back the Debug Executable box, and all was fine again.
Edit: found out it was because I was trying to run release mode on my phone via App Store provisioning profile and App Store profile doesn't allow this. I switched to Ad Hoc and there is no more issues.
I guess you already tried this, but I just got the same error, and a quick restart of Xcode worked for me.
Just upgrade to Xcode 8.1. It solves the problem.

Signing issue building using a bot

I'm setting up a CI machine and the problem I'm facing is that the build fails with a profile/signing error when built using the bot.
However if I manually clone the project onto the CI machine and build it manually from within XCode on the build machine then it is successful - this shows that the CI machine's keychain is correctly set up and the profiles/signing setting of the project are all ok.
That fact that I can manually build it on my dev machine and on the CI machine but not using the bot suggests to me that the bot is running as a different user?
So my question is how do I set up the X Code server account / bot to be the correct user? The Apple Xcode CI document isn't very clear on this area, I've followed the instructions for configuring the server, configuring the bot, adding group members to the XCode server etc. but something must have been incorrectly configured. Trouble is I've followed the documentation step by step but don't know where I could have gone wrong.
Anybody know of a good alternative bot tutorial as an alternative to Apple's documentation or have an idea what the problem might be?
Copy the relevant provisioning profiles from
~/Library/MobileDevice/Provisioning Profiles
to
/Library/Server/Xcode/Data/ProvisioningProfiles
and it'll build fine.
You might need admin permission to access that folder, though.
And if that doesn't work, copy the relevant certificates/private keys from the login keychain to the System keychain.
The reason behind this is because..Xcode only downloads provisioning profiles that are managed by Xcode, which are the Team Provisioning profiles.
So you would only need to copy the ones that are not managed, like Adhoc Distribution profiles, and other custom provisioning profiles that are not created by default after creating a new Application ID.

What's the authoritative resource for TestFlight deploys with Jenkins?

As stated in the question, but including code signing and embedding provisioning profiles.
I recently posted a series of blogs on how to build/test/deploy both iOS and Android apps using Jenkins running on the CloudBees PaaS: the iOS blog is online at
Continuous Deployment for Mobile Apps with Jenkins: Xcode builds with MacOS slaves
That blog post actually talks about Appaloosa, but the Jenkins configuration for TestFlight is almost identical: you can see an actual example config online here:
stockfishchess-ios Jenkins configuration
A few things to note:
You need to make sure that the build number is unique - the best way to do this is just to get the Jenkins build number from the environment (see the example config).
You need to configure the build job to package an .ipa archive (the example config uses the fast archive plugin to do this)
You should copy the API Token and Team Token from your TestFlight Console
Re: iOS Provisioning - look at the Apple Developer Program docs for details on how to set up an Ad Hoc Provisioning profile, which you will need to send to your testers. Get their UDIDs for the devices they want to use, create the profile using the iOS Provisioning Portal and use the Xcode Organizer to export the .mobileprovision profile. You will also need to go into TestFlight and invite the beta test users.
You can find my contact details on the blogs - feel free to contact me directly if you need further help.

iOS on Jenkins: Provisioning profile can't be found

I know there are a lot of questions similar to mine on this site, but none seem to be what I am looking for with a few environment changes.
I'm running an osx Dumb Slave set up using Java Web Start. I'm not running as root, nor a specific user entitled 'jenkins,' but rather a normal user. I've installed the xcode plug-in on Jenkins. Everything seems to start up fine, and it's loading the files on the slave server, however, once I begin to build (post-clean), I run into this error:
Provisioning profile '<uuid>' can't be found
I've set the certificate to both login AND system and just login and just system. I copied the .p12 certificates that I was currently using on another machine. I'm at a loss. If anyone can possibly help or even link me to maybe some stackoverflow question I have yet to try, that would be great.
Thanks!
I had to search through my project.pbxproj to all the provisioning profiles. It seemed there was an old number and a new number (used in different apps). I had to realign the provisioning number to the new one.

iOS: When to Use Which Code Signing Identity in The Build Configuration?

I am never very clear regarding to which Code Signing Identity I should use in the Build Configuration concerning which scenario, and would love if someone can explain it in the most simple way.
This is what I know:
I create in the Provisioning Portal and implement in my apps both a Development Profile and a Distribution Profile.
Then I assign the Project >> Build Settings >> Code Signing according to the different profiles:
Here is the first question: What is the difference between Release and Distribution? Which one should be connected to the Developer profile and which one should be connected to the Distribution profile?
Now, if I understand correctly, I'm supposed to set the "Scheme" before I run the app:
There are 5 different steps in which I'm required to define the Build Configuration by selecting one of the Code Signing Identity:
Here is the BIG QUESTION... In which scenario I should select which Code Signing Identity?
I always run the app on the same 2 devices: my iPhone and my iPad; both are defined in the Provisioning Portal and set into the profiles.
I only want to make sure I run it OK for testing on Simulator and on Device and later on to build the app for uploading to App Store.
Any assistance / direction will be much appreciated.
By default, the standard Apple templates only create Debug and Release configurations. Distribution seems to be redundant with Release.
Debug is the configuration used when you are actually working on the code, and Release is used when you archive it for other people to install. You should use your developer profile for Debug and your distribution profile for Release.
You should also probably use your distribution profile for distribution, but you should really check with whoever created that configuration to see what its purpose is first.

Resources