mmcc007/fledge

ios certificates are not working

yvanvds opened this issue · 3 comments

Hey, thanks for this. I followed your tutorial, using github and travis-ci. But my iOS build is stuck at sync_code_signing. I've disabled the suppress_output wrapper in Fastfile to get some more output, but can't really paste it all in here because there's a lot of sensitive text in there.

First step is loading the Matchfile, which is successful. Detected values are ok. Next the remote git repo is cloned and i get the message 'Successfully decrypted certificates repo. Sounds good.

Now there's an error:

[13:17:03]: Installing certificate...
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
[13:17:04]: There are no local code signing identities found.

My first thought that this was the problem, but I'm not sure. Because next it lists my Installed Certificate with all details and below that the Installed Provisioning Profile. Then I get a message:

All required keys, certificates and provisioning profiles are installed 🙌
[13:17:04]: Setting Provisioning Profile type to 'app-store'
[13:17:04]: Certificates and profiles installed
[13:17:04]: -----------------------------------------
[13:17:04]: --- Step: update_project_provisioning ---
[13:17:04]: -----------------------------------------
[13:17:04]: You’re updating provisioning profiles directly in your project, but have you considered easier ways to do code signing?
[13:17:04]: https://docs.fastlane.tools/codesigning/GettingStarted/
[13:17:04]: Downloading root certificate from (https://www.apple.com/appleca/AppleIncRootCertificate.cer) to path '/tmp/AppleIncRootCertificate.cer'
[13:17:04]: Error setting value '' for option 'profile'
+------------------------------------+---------------------------------------------------------+
| Lane Context |
+------------------------------------+---------------------------------------------------------+
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/travis/Library/Keychains/login.keychain-db" |
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios beta |
| SIGH_PROFILE_TYPE | app-store |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"com.mute.klankenbos"=>"match AppStore com.mute.klankenbos"} |
+------------------------------------+---------------------------------------------------------+
[13:17:04]: Path to provisioning profile is invalid

So there's two errors here, right before and right after the Lane Context listing. And that's when the build stops, so I guess they're the real problem here. But since loading the certificates and profiles worked, I'm not sure where I should look now.

Any ideas? The fastlane match configuration succeeded without any problems earlier. I do realise that this is probably not an issue with your project, but I did follow all instructions in your manual. So it might be that something was left out. (Or maybe I simply forgot one of the steps, of course.)

Thanks for the kind words.

I think I have found the problem.

In ios/Fastlane, replace:

    update_project_provisioning(
      xcodeproj: 'Runner.xcodeproj',
      target_filter: 'Runner',
      build_configuration: 'Release',
      profile: ENV['sigh_com.orbsoft.todo_appstore_profile-path'],
    )

with

  app_identifier=CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
  profile_name='sigh_' + app_identifier + '_appstore_profile-path'

    update_project_provisioning(
      xcodeproj: 'Runner.xcodeproj',
      target_filter: 'Runner',
      build_configuration: 'Release',
      profile: ENV[profile_name],
    )

I tested the new code on my local clone of the https://github.com/mmcc007/todo app and it worked.

BTW: In your project, if you have your local environment set-up with the following variables:

FASTLANE_USER
FASTLANE_PASSWORD
GOOGLE_DEVELOPER_SERVICE_ACCOUNT_ACTOR_FASTLANE
KEY_PASSWORD
PUBLISHING_MATCH_CERTIFICATE_REPO
MATCH_PASSWORD

you can then test the start of a beta (or a release) for either android or iOS by 'cd'ing into the 'ios' or 'android' directory and running 'fastlane ios beta' or 'fastlane android beta'

If this works for you too, I will update to Fledge

Hope this helps

It works. Awesome!

I got a few quirks down the road though.

First is that my account has 2 step verification enabled. You do mention this in your manual. I created a second account, but when I tried to verify that i could login with it, it asked me to add security questions. I thought this might be another kind of 2 step verification, so I spent half an hour trying to disable it. Turns out it wasn't a problem at all, but maybe you could mention that part in your manual to save overly cautious people like me from this :-)

Next I also needed to provide my Team ID in the ios Appfile. Perhaps this is only required because i have multiple teams? But again, it could be added to the manual.

After that I am able to upload to the app store (will have to test android later).

But then there's another problem: I cannot increase the version number. Reading the manual, i was under the assumption that it would increase automatically? Either way, increasing it manually does not work either:

fastlane start_beta major
[17:25:06]: fastlane detected a Gemfile in the current directory
[17:25:06]: however it seems like you don't use `bundle exec`
[17:25:06]: to launch fastlane faster, please use
[17:25:06]: 
[17:25:06]: $ bundle exec fastlane start_beta major
[17:25:06]: 
[17:25:06]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[17:25:11]: ---------------------------
[17:25:11]: --- Step: opt_out_usage ---
[17:25:11]: ---------------------------
[17:25:11]: Disabled upload of used actions
[17:25:11]: Could not find lane 'start_beta major'. Available lanes: start_beta, release
+------+---------------+-------------+
|          fastlane summary          |
+------+---------------+-------------+
| Step | Action        | Time (in s) |
+------+---------------+-------------+
| 1    | opt_out_usage | 0           |
+------+---------------+-------------+
[17:25:11]: fastlane finished with errors
[!] Could not find lane 'start_beta major'. Available lanes: start_beta, release

I'm not sure how to handle that, because when I google for how to increase the build number with fastlane, the instructions don't come near to what is in your manual. So far i get by with removing the tags from git with:

git tag -d 0.0.1
git push -d origin 0.0.1

But that won't help me when i actually want to publish a new build.

Again, thanks for helping.

BTW: I split out your last comment to the three issues linked above so I could close out this issue with the fix described in the above merge, and track the issues from your last comment separately.

Thanks for your great feedback!

Feel free to add more issues and PR's as you encounter them.