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

Update: [Here is a screencast of the whole process.][1]

Update 2: Discovered a workaround. Scroll down to the “accepted answer” at the bottom of the page.

tvOS distribution packaging is not working at all for me. I managed to workaround the development packaging issues through the [patch + workaround in this answerhub post I started in October][2].

Now I need to package for distribution, and I am having no luck.

My app is named “Topple Town”. The certificate(s), app id(s), and provision(s) are all brand-new, made just for this app. I will list the various things that I have tried thus far.

HERE IS EXACTLY WHAT I HAVE TRIED

This is on a Mac Pro (Late 2013), 10.11.6, Xcode 8.1

All of the certificate/id/provision stuff is done using the web gui of Apple’s “Certificates, Identifiers & Profiles” section of developer.apple.com

  1. Generate Production certificate of type App Store and Ad Hoc. You can’t choose it’s name…they auto name it Nathaniel Stocks, because that’s my name. Type is set to iOS Distribution. I am somewhat concerned that there is nothing tvOS-specific, but there are no options for App Store certificates other than this one that I selected.
  2. Generate App ID on Apple’s site: Name: Topple Town, ID com.agileperception.toppletown
  3. Create Distribution Provisioning Profile. Name: Topple Town tvOS Distribution Profile, Type: tvOS Distribution, App ID: Topple Town (com.agileperception.toppletown)
  4. Delete ALL certificates from Keychain Access and delete ALL provisions on my Mac from ~/Library/MobileDevice/Provisioning Profiles
  5. Download the certificate from step #1. In Project Settings > iOS I click Import Certificate and select the downloaded certificate file, which succeeds (see screenshot after step 6)
  6. I download the provision from step #3. I click Import Provision and select the downloaded file, which succeeds (see screenshot below)

  1. I set Bundle Display Name to Topple Town
  2. I set Bundle Name to toppletown
  3. I set Bundle Identifier to com.agileperception.toppletown
  4. I select File > Package Project > tvOS, which causes an instant error.

…and you get these errors

Here is the full text of the output log from the session: [tvOS_distribution_errors_from_output_log.txt][5]

You can see the certificate and provision getting imported on lines 271-275. Everything after that is from trying to make the package.

So what now?

I have also tried the following variations:

  1. Wildcard App ID’s with corresponding Provisioning Profiles that use them.
  2. Checking the boxes next to the provision and certificates
  3. Upgrading to 4.14.0
  4. Building 4.13.2 from source [with this additional patch][6]

Nothing I have tried so far has so much as changed the error message that I get.

Tell me what I should try, and I will dutifully try it! I just want to get my project onto the app store for tvOS!

CleanCut,

Try reinstalling your certificates and provisions through the Editor, not Xcode. There is a known issue for this which isn’t fixed in 4.14.0 (UE-38006).

Thanks!

Samantha, I’m very sorry but that has no effect.

I deleted all certificates from Keychain access. I deleted all provisions from ~/Library/MobileDevice/Provisioning Profiles/. I opened my project in 4.14.0. I imported the certificate and provision through the Editor. I attempted to package for tvOS on the desktop and received the same set of errors.

As a side note, please be aware that the commit linked to from UE-38006 is present in the 4.14.0-release tag in GitHub. (ie the listed patch is IN 4.14.0).

What else can I try?

Have you made sure your Worldwide Developer Relations Intermediate Certification is up to date?

https://developer.apple.com/support/certificates/expiration/

I have never seen that before! Unfortunately, that also does not change the errors at all. Same behavior. I tried deleting all certificates and provisions, then deleting the expired WDRIC (the new one is already there), then also deleting all other expired items in Keychain, then importing the distribution certificate and provision through the editor. All that, and the exact same “not found” errors. This was all on 4.14.0.

On the bright side, it did fix this other issue I was experiencing, so I will update that answerhub post. That’s something. Now I have two machines I can try things on.

What else can I try?

I get the same error on a Windows. I haven’t tried it on a mac yet. I have a valid certificate and tvOS mobileprovision profile and they both show green in the Project settings and I’m using a new blank project.

If I have the iOS mobileprovision profile present also with the same bundle identifier it tries to use the iOS profile instead of the tvOS profile and of course I get an entitlement error because it used the wrong profile.

Glad to know it’s a cross-platform bug. Hopefully that means it will get more attention.

CleanCut,

I’m so happy to hear that at least one of your issues has been resolved thus far. So I ran a test today and I ran into the ‘provisions not found’ error while packaging for tvOS.

I spoke with our tvOS Specialist to ensure there wasn’t an actual issue. He then tested and did not have a problem.

I was able to resolve it by doing the following:

  • Closed the Editor
  • Removing my provisions from the provisioning profile
  • Opened the Editor back up
  • Added only the Provisions that I needed for tvOS
  • Added only the certificate that would be used for tvOS
  • Packaged the project for tvOS

This corrected the issue for me. I know you have double checked multiple times that you’ve used the correct provisions and certificates, but you might need a complete refresh.

There was some provisioning logic changed when Xcode was updated therefore, any older certificates/provisions were causing errors during packaging.

Upload new logs as you continue testing, please.

I have deleted ALL the provisions and certificates every time. I have only been using certificates/provisions for tvOS during this process. I don’t know what you expect to change(?)

Nevertheless, I will run through the entire process again as you laid out with both 4.13.2 and 4.14.0 and attach the logs as you request. I just upgraded my workstation to macOS Sierra last night, so perhaps that will affect something as well (though my laptop is already on macOS Sierra and exhibits the same behavior).

By the way, there is only one certificate type for distribution. Were you testing with production/distribution settings? This is different than developer settings. Also, what value did you put for your App ID? Did it use a wildcard at all?

The certificate I created was the “Production: App Store and Ad Hoc” certificate, and it names itself ios_distribution.cer externally and iPhone Distribution: Nathaniel Stocks (...) internally, despite the fact that I’m using it for tvOS.

Deleted all certificates and provisions beforehand
macOS Sierra 10.12.1
Xcode 8.1
UE 4.13.2

  • Distribution certificate
  • Distribution provision for app id com.agileperception.toppletown

117695-screen+shot+2016-12-06+at+9.13.02+pm.png

117696-screen+shot+2016-12-06+at+9.13.18+pm.png

[link text][5]

Deleted all certificates and provisions beforehand, macOS Sierra 10.12.1, Xcode 8.1, UE 4.13.2

  • Distribution certificate
  • Distribution provision for app id *

117703-screen+shot+2016-12-06+at+9.19.05+pm.png

117704-screen+shot+2016-12-06+at+9.19.16+pm.png

[link text][5]

Deleted all certificates and provisions beforehand, macOS Sierra 10.12.1, Xcode 8.1, UE 4.14.0

  • Distribution certificate
  • Distribution provision for app id com.agileperception.toppletown

117709-screen+shot+2016-12-06+at+9.30.10+pm.png

117710-screen+shot+2016-12-06+at+9.30.19+pm.png

[link text][5]

Deleted all certificates and provisions beforehand, macOS Sierra 10.12.1, Xcode 8.1, UE 4.14.0

  • Distribution certificate
  • Distribution provision for app id *

117714-screen+shot+2016-12-06+at+9.37.16+pm.png

117715-screen+shot+2016-12-06+at+9.37.30+pm.png

[link text][5]

CleanCut,

Thank you for pointing out that it’s distribution having the issue. I have submitted a JIRA UE-39501 to our developers for this issue. Please check our public Jira for updates.

Thanks!

Thank you!!!

Samantha, first off, thanks for all your help so far!

Next, it appears that you marked my issue regarding development provisions and certificates as a duplicate of this one and that the comments were locked.

  1. I never received a notification email that that issue was marked as a duplicate. In addition to the comments being locked, that makes it really difficult to notice and tell you that it’s not a duplicate! Is this an AnswerHub bug?

  2. It’s not a duplicate. It’s a problem with development provisions, instead of distribution ones.

I notice that you seem to be able to run the development profiles fine, yourself, but I can’t get it to work following those same steps.

I am really trying to get to market on the AppleTV, so these issues are really important to me. So, I’m going to wipe my hard drive and install macOS Sierra from scratch and reinstall programs individually without restoring from backup. At the very least, perhaps I could deploy to the AppleTV in development mode to continue QA testing.

If you would go unlock the other AnswerHub post, we could continue our conversation there.

Thanks for pointing that out, it’s very easy to believe questions are duplicates when they’re so similar. I’m opening it back up. Please reply back to it when you’ve done the checks on your end to try and resolve the issue.

I’ll post the steps on that one too, in case anyone else runs across it. :slight_smile:

Cleancut,

This suggestion may seem obvious and something you may have tried already but I was getting a slightly different error than yours when I didn’t check the box for the provision and certificate in the project settings.

Best of luck,
Omar

@nomahr I am happy to (re)try anything that could possibly get it working again. Thanks for the suggestion.

Checking the boxes of my distribution certificate and a distribution provision with a specific app id doesn’t appear to have any effect.

I’m on UE 4.14.1 now, with a from-scratch installation of macOS Sierra, and I revoked/deleted all my production certificates/provisions and recreated them from scratch just a moment ago.

118054-screen+shot+2016-12-09+at+10.07.18+am.png

118055-screen+shot+2016-12-09+at+10.07.23+am.png

[output log file for distribution cert plus specific app id provision][5]

UE 4.14.1, Xcode 8.1, fresh macOS Sierra.

Checking the boxes of my distribution certificate and a distribution provision with a wildcard app id also doesn’t appear to have any effect.

118060-screen+shot+2016-12-09+at+10.18.07+am.png

[output log file for distribution cert plus wildcard app id provision][5]