Xamarin iOS Provisioning Gotchas

I managed to create scenario where debugging from Visual Studio 2017 to iOS Simulator was giving me absolute fits because the error messages are so unhelpful… as usual, it was my own fault of course, but gosh it’s scary how easily one can fall in that deep dark pit where hopes and dreams go to die ; )

Example Error Messages

  • Application X need to be rebuilt due to an inconsistency between the connected Mac and the local app
  • Visual Studio cannot start the application automatically because it was signed with a Distribution provisioning profile. Please start it by tapping the application icon on the device

TL;DR

In my case it was because the “Bundle ID” aka “App ID” set in my info.plist was incompatible with the provisioning profiles actually available on my Mac build host and selected in the iOS project settings.

More background

  1. My Provisioning Certificates had expired (as we know, issued from http://Developer.Apple.com) … that did throw me off for a bit but eventually I got the clue and went through the Apple Developer account renewal process…
  2. Funny thing, I’d been waiting for our Apple Enterprise Developer aka In House distribution account to finalize… I noticed it had finally opened up (there’s a big yellow sign indicating 2wk delay between approval and the corresponding “In House” radio button becoming available on the provisioning profile page) and decided to just run with that vs my personal Developer keys…
  3. This meant I was creating all the necessary provisioning bits from scratch…
  4. First up, creating my App ID aka Bundle Id record (cue foreboding thunderclap)… ‘course when you’re establishing a new name, it’s always fun to apply your more current understanding of just what that name should be… here’s where I messed up, this App ID gets embedded in the provisioning profile which must then be the same as what’s in your iOS project’s info.plist > CFBundleIdentifier entry !!
  5. So while I did realize I needed to go select those new Identity/Provisioning profile entries in the iOS project settings > iOS Bundle Signing page, there’s nothing obvious in the error messaging to smack us in the head about App Id conflict.

Saving Grace

reading this post… suggested compiling under Xamarin Studio on the Mac for more error visibility… that’s a good basic technique reminder… I also use Xcode for this at times… at this point we’ve got Visual Studio for Mac so i fired that up and it did indeed provide significantly more helpful messaging, which got me back on track – Good to know !

Developer vs Distribution Profile – what’s the difference?

Somehow I’d never really run smack into this but one pertinent difference during development is that choosing a Distribution Profile will require you to manually launch your app on the iOS Simulator vs Visual Studio being able to launch it for you… so choose a Developer profile until you’re really in the mode to push builds out to real end user devices.

image