tvOS package for distribution fails to find valid certificate and valid provision [UE-39501] [Workaround]

tvOS Distribution Package PARTIAL Workaround (4.14)

Bug [UE-39501][1]

Thanks to @ for the key information leading to this workaround!

  • Import both development and distribution certificates (They will both be called “iOS” certs despite the fact that they work across both iOS and tvOS provisions)
  • Import mobile provisions for each of the 4 combinations of development/distribution and iOS/tvOS (dev+iOS, dev+tvOS, dist+iOS, dist+tvOS)
  • (Just) The tvOS provisions MUST use a wildcard identifier * to get past the next bug that you will hit (the engine ignoring your config and trying to literally match com.YourCompany.[PROJECT_NAME] against your provision’s app id)
  • File > Package Project > tvOS

It looks like this:

For DISTRIBUTION you then need to do the additional steps:

  • Near the end of the output log is a long line that starts with /usr/bin/codesign --force --sign ... – copy this code signing line and keep it until we need it several steps along the way below
  • Unzip the .ipa' file either by opening it with Archive Utility.appor runningunzip filename.ipain the terminal. (This will extract it into aPayload` folder)
  • Open Payload/UE4Game.app/Info.plist in a text editor (or the plist editor) and change YourName in the bundle identifier to your organization name used on your apple developer account. For example, I changed my bundle identifier from com.YourCompany.ToppleTown to com.agileperception.toppletown – notice that the case (upper/lower) of the app id has to match your app id in Apple’s developer console exactly.
  • Get the code signing command that you saved from a few steps ago (the one that starts with /usr/bin/codesign...) and run in in Terminal.app
  • Re-zip the fixed package with zip -r SomeName.ipa Payload
  • Upload your app by going to Xcode and selecting Xcode > Open Developer Tool > Application Loader and using that version of the Application Loader that shipped with your current Xcode. This is stored inside Xcode itself, so using any other version will eventually get you into trouble.

And that’s as far as this workaround gets you. There are at least 5 more bugs which I cannot yet work around:

You get a little farther on the unreleased 4.15 branch

  • You don’t have to do the unzipping, code signing, re-zipping
  • You hit less errors uploading to the app store (these two errors have a separate post [here (for both of them)][4] and [here (for one of them)][5]:

Extra Tips:

  • If your app fails to launch on the AppleTV after the installation step, try deleting the existing app from the AppleTV (hold down the main button on the app, then press play/pause, then select delete)
  • The [GetPlatform blueprint node erroneously returns “IOS” on tvOS][7].