Issues while setting up Continuous Integration and Delivery with Visual Studio Team Services for Xamarin.iOS Apps
As an one-man casual mobile developer for a bascially-no-one-uses iOS app. Developing the app is fun but the tasks that're required to release the app are always so tedious.
I developed the app using Xamarin.iOS and luckily Visual Studio Team Services(VSTS) just releases an Apple App Store extension which can automate the processes. Spent some time to set the whole thing up, was going to do a step-by-step tutorial, but thought why creating redundant stuff so just gonna share some issues I encountered along the way.
The goal to achieve after setting this up should be:
Develop the code and check in, queue a build in VSTS. That's it.
Tutorials I followed
They plus the links they references pretty much covers all setups required.
Will start on issues now.
1. While trying to export P12 certificate in Xcode, "Export" is greyed out.
If you managed to export the certificate from KeyChain, when you build in VSTS, it still gives you the error "1 identity imported." then "0 valid identities found".
Solution Link: This certificate has an invalid issuer : Keychain marks all certificates as “Invalid Issuer”
After deleting expired certificates and installed the downloaded AppleWWDRCA.cer, "Export" in Xcode will be available and certificate exported from Keychain will be valid as well.
2. IPA build output folder has a "name date time" format makes it hard to define the IPA path in following build steps.
I used my Mac as build agent, there is no issue while building using Xamarin but does this while building as a Mac Agent.
Solution Link: Xamarin cycle 7 IOS IPA output now in a datetime folder
After applying the changes, I also defined "Package Name" in "iOS IPA Options" tab in Project Options. I set it to a fixed name, pretty sure this is not best practise, but doesn't matter anyway.
In this case, the output IPA always has the path: "AppName.IOS/bin/iPhone/$(BuildConfiguration)/AppNameDefined.ipa". Much easier for later setups.
3. How to setup Metadata structure for "App Store Release" build step.
The "App Store Release" build step only accepts a path for metadata folder. For someone who hasn't used Fastlane before, I had no idea what to put in the folder. So I installed Fastlane locally and ran "deliver init" in a folder I created in source control. It will prompt questions to connect to iTunesConnect and download all metadata of an existing app and create all files in the folder.
After that, I just added "description.txt", "keywords.txt" and "release_notes.txt" into the solution, so I can update all information needed right in Xamarin Studio.
Note: while setting it up I thought about if this is all done by Fastlane, why should I use VSTS? My answer is that VSTS supports more build tasks and in this way I will not be depend on my machine. Plus I just like the feeling of utilizing those cool tools online...
4. Got error while installing Fastlane: "ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/commander".
Use this command: "sudo gem install -n /usr/local/bin fastlane"
Reference: Problem when install fastlane
5. App doesn't get submitted for review although log says "Successfully submitted the app for review!"
The reason is "submission_information" is not set for fastlane.
In your "fastlane" folder, there should be a file "Deliverfile", the content should look like this:
app_identifier "xx.xxx" # The bundle identifier of your app
username "[email protected]" # your Apple ID user
submission_information({
add_id_info_uses_idfa: false,
export_compliance_encryption_updated: false
})
submission_information is the bit you should have in the file. The values to set depending on your application. I normally get asked for those 2 questions so I added those 2 in there then the issue is gone. You can view the full official documentation below for all options and use what you need. Offical Doc: submission_information
6. [Unresolved] "Copy files" build task doesn't copy .dSYM files when it's a more exact pattern match.
So in the "Copy files" task, you define "Source Folder", "Contents" and "Target Folder". In "Contents" you normally use "**/*.ipa" to match the ipa files. But when I use "**/*.dSYM", it doesn't copy the file, always says "matched 0 files".
I have tried all kinds of combinations for the pattern: only root folder, all folders, exact name match, lower cases and including dots, none worked. But when I use "**", it's copied across. When I use "**/*.config", config files get copied.
I don't get it...
Luckily, since everything is done from the agent, so instead of copy the .dSYM files to artifacts folder, I use the direct path (like this one: "AppName.IOS/bin/iPhone/$(BuildConfiguration)/AppNameDefined.app.dSYM") to the build bin folder when uploading it to HockeyApp. So for now, it's not a big issue. But this bother me so bad...
I posted a question in StackOverflow as well: Copy Files in VSTS just doesn't work from dSYM files. Hopefully someone can help out.
That's all the issues I have encountered. Mine might not be best practises and might even be wrong, but for me, as long as it works :-)