Bug 36189 - Archiving for Publishing generates wrong value for CloudKit entitlement preventing distribution
Summary: Archiving for Publishing generates wrong value for CloudKit entitlement preve...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: XI 9.2
Hardware: PC Mac OS
: Highest blocker
Target Milestone: C6SR1
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2015-11-23 23:09 UTC by Frank A. Krueger
Modified: 2016-03-03 17:28 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Screenshot of the error from iTunes Connect (161.84 KB, image/png)
2015-11-23 23:09 UTC, Frank A. Krueger
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Frank A. Krueger 2015-11-23 23:09:38 UTC
Created attachment 13960 [details]
Screenshot of the error from iTunes Connect

See attached picture from Application Loader.

com.apple.developer.cloud-container-environment isn't being set.

From https://developer.apple.com/library/ios/technotes/tn2415/_index.html:

        <key>com.apple.developer.icloud-container-environment</key>
        <array>
            <string>Development</string>
            <string>Production</string>
        </array>

Build log: http://pastebin.com/VtSLF4RU

=== Xamarin Studio ===

Version 5.10 (build 860)
Installation UUID: e51e2705-c52a-4ae8-aa07-c481d6ab8a7a
Runtime:
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

=== Xamarin.Profiler ===

Version: 0.22.0.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 6.0.0.34 (Enterprise Edition)
Android SDK: /Users/fak/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)

SDK Tools Version: 23.0.5
SDK Platform Tools Version: 21
SDK Build Tools Version: 20

Java SDK: /usr
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.1.1 (9081)
Build 7B1005

=== Xamarin.iOS ===

Version: 9.2.1.51 (Enterprise Edition)
Hash: 3c0ec35
Branch: master
Build date: 2015-11-12 13:05:39-0500

=== Xamarin.Mac ===

Version: 2.4.0.109 (Enterprise Edition)

=== Xamarin Inspector ===

Version: 0.3.2.3
Hash: 1b526e6
Branch: master
Build date: Tue Nov 17 20:54:30 UTC 2015

=== Build Information ===

Release ID: 510000860
Git revision: 3eb3dc2331dd58fb41c5f23dc34fcc36a3889dc4
Build date: 2015-10-29 16:17:32-04
Xamarin addins: 4bb33cddb23f1258ca6c3522d5424959b1a63a9e
Build lane: monodevelop-lion-cycle6-ipad-pro

=== Operating System ===

Mac OS X 10.11.1
Darwin lepton.local 15.0.0 Darwin Kernel Version 15.0.0
    Sat Sep 19 15:53:46 PDT 2015
    root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
Comment 1 Jeffrey Stedfast 2015-11-24 11:31:46 UTC
Fixed in git master and a PR has been made for cycle6 awaiting review
Comment 2 Frank A. Krueger 2015-11-25 09:17:56 UTC
Did this make it into the latest Stable release?

I can't distribute my app without this fix...
Comment 3 Frank A. Krueger 2015-11-25 09:19:55 UTC
I see, it's in the Alpha channel https://releases.xamarin.com/alpha-preview-cycle-6-service-release-0/
Comment 4 Frank A. Krueger 2015-11-30 20:49:11 UTC
This is not fixed in the Alpha channel. Still getting this error:


Package Summary:
 
1 package(s) were not uploaded because they had problems:
	/var/folders/db/4q6xfd4n68bg30j28vpc_c800000gn/T/F464E0FA-FC5A-4C41-8016-317A44802A24/635757879.itmsp - Error Messages:
		ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, value '' for key 'com.apple.developer.icloud-container-environment' in 'Payload/Calca.app/Calca' is not supported. This value should be a string value of 'Production'"

Build log: http://pastebin.com/2aYr1Rsd

=== Xamarin Studio ===

Version 5.10.1 (build 1)
Installation UUID: e51e2705-c52a-4ae8-aa07-c481d6ab8a7a
Runtime:
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

=== Xamarin.Profiler ===

Version: 0.22.0.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 7.1.1 (9081)
Build 7B1005

=== Xamarin.iOS ===

Version: 9.2.1.52 (Enterprise Edition)
Hash: d070a7b
Branch: master
Build date: 2015-11-23 12:29:45-0500

=== Xamarin.Android ===

Version: 6.0.0.34 (Enterprise Edition)
Android SDK: /Users/fak/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)

SDK Tools Version: 23.0.5
SDK Platform Tools Version: 21
SDK Build Tools Version: 20

Java SDK: /usr
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.4.0.109 (Enterprise Edition)

=== Xamarin Inspector ===

Version: 0.3.2.3
Hash: 1b526e6
Branch: master
Build date: Tue Nov 17 20:54:30 UTC 2015

=== Build Information ===

Release ID: 510010001
Git revision: bee8b40553477ae2f5a5fdb19b7c9aa2505c3b02
Build date: 2015-11-23 15:39:53-05
Xamarin addins: d456dff337fe54102a1d98f6cf49c5abe0747ee3
Build lane: monodevelop-lion-cycle6-baseline

=== Operating System ===

Mac OS X 10.11.1
Darwin lepton.local 15.0.0 Darwin Kernel Version 15.0.0
    Sat Sep 19 15:53:46 PDT 2015
    root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
Comment 5 Frank A. Krueger 2015-11-30 20:52:45 UTC
Jeffrey, you can see the code here:

https://github.com/praeclarum/Calca

To build it, you need to checkout:

https://github.com/praeclarum/Preaclarum

alongside it.
Comment 6 Jeffrey Stedfast 2015-11-30 21:14:59 UTC
Unfortunately my patches didn't make it into the Alpha :(

They were just merged 30 minutes ago, so they'll be in the final.

In the meantime, give these builds a try:

http://storage.bos.internalx.com/macios-mac-cycle6-icloud-fix/b3/b389a3f305a2194bf670c6fbecc1b1d26582220c/monotouch-9.2.2.6.pkg
http://storage.bos.internalx.com/monodevelop-lion-cycle6-icloud-fix/da/da2bcdd4b3f901aa91b7f999f02f42cbfc9a4d4d/XamarinStudio-5.10.2.5.dmg

These *should* work. QA has tested them and the fixes worked for them.
Comment 7 Frank A. Krueger 2015-12-21 22:50:22 UTC
When will this make it into real builds? I'm kinda hesitant to release my app using a hot fix from a bug report.

The fix is not in the current Alpha: MT 9.4 no XS 5.10.2
Comment 8 Jeffrey Stedfast 2016-01-04 18:45:11 UTC
Sebastien:

Do you know if commit eb4c1ef17565dbae05fa0d78142941d7928fa332 on the cycle6-xi branch has made it into Stable yet? Or know when it will be?
Comment 9 Sebastien Pouliot 2016-01-04 18:59:39 UTC
$ git branch --contains eb4c1ef17565dbae05fa0d78142941d7928fa332
  cycle6-xi
  cycle6-xi-baseline
* cycle6-xi-c6sr1
  maccore-c6sr0-hotfix-36383
  xcode7.2

Since it was in `xcode7.2` (iOS 9.2 support) then it should already be in XI 9.4.0 (on stable), likely part of C6SR0 ?.

If it does not work then something else might be broken.
Comment 10 Jeffrey Stedfast 2016-01-07 20:32:17 UTC
FWIW, the app will need to be rebuilt because the publishing workflow in XS doesn't know how to "fix" the entitlements.

Frank: are you rebuilding your app and publishing a newer archive?

What the MSBuild targets do now is to set:

        <key>com.apple.developer.icloud-container-environment</key>
        <string>Development</string>

And then the publishing workflow, when it finds that key/value, replaces it with:

        <key>com.apple.developer.icloud-container-environment</key>
        <string>Production</string>
Comment 11 Frank A. Krueger 2016-01-07 21:00:25 UTC
My current release process is:

1. Build my release version with dev certs
2. Test it on a device as a unity check
3. Archive it for publishing
4. Use your publishing wizard to build the IPA
5. Use Apple's App Loader to upload
Comment 12 Jeffrey Stedfast 2016-01-07 21:59:45 UTC
D'oh, I figured out the problem.

The key is being added to the code-signing entitlements, but not to the archived-expanded-entitlements.plist in the archive, so the publishing logic, when expanding it again, did not have the value.
Comment 13 Frank A. Krueger 2016-01-08 03:14:54 UTC
Cool, so how can I submit my app?
Comment 14 Frank A. Krueger 2016-01-08 03:28:20 UTC
I guess that's to say: may I have a build?
Comment 17 Arpit Jha 2016-01-14 04:05:17 UTC
I have checked this issue with latest C6SR1 build( XS 5.10.2 (build 51) + 9.4.1.21 (Enterprise Edition) Hash: c71a120 ) and able to upload IPA(iCloud service enabled) file to app store successfully.

Screencast: http://www.screencast.com/t/4T8y1RE4p
Environment Info: https://gist.github.com/Arpit360/1d57be72cd05725d796f

Hence closing this issue