Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25319] iOS: Fails to package app when using CloudKit

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-09-20T22:08:40.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.3.0
ComponentsiOS
Labelsn/a
ReporterChris Barber
AssigneeChris Barber
Created2017-09-19T16:50:24.000+0000
Updated2017-09-21T03:33:13.000+0000

Description

When packaging an app that uses CloudKit, the IPA export fails:
[DEBUG] Running: /Applications/Xcode-9-gm-seed.app/Contents/Developer/usr/bin/xcodebuild -exportArchive -archivePath "/Users/chris/appc/workspace/testapp3/build/iphone/testapp3.xcarchive" -exportPath "/Users/chris/appc/workspace/testapp3/dist" -exportOptionsPlist "/Users/chris/appc/workspace/testapp3/build/iphone/export_options.plist"
[TRACE] 2017-09-19 11:46:26.873 xcodebuild[38383:2547226] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/wx/j1v32g355xj28rnt9yb_6hfm0000gn/T/testapp3_2017-09-19_11-46-26.872.xcdistributionlogs'.
[TRACE] 2017-09-19 11:46:26.954 xcodebuild[38383:2547226] [MT] IDEDistribution: Step failed: <IDEDistributionOptionsStep: 0x7f99adee0400>: Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided" UserInfo={NSLocalizedDescription=exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided}
[TRACE] error: exportArchive: exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided
[TRACE]
[TRACE] Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided" UserInfo={NSLocalizedDescription=exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided}
When packaging, the code needs to open the generated entitlements plist file and check if it is using CloudKit, then set the export option.

Comments

  1. Chris Barber 2017-09-19

    Ti SDK master PR: https://github.com/appcelerator/titanium_mobile/pull/9446 Ti SDK 6_3_X PR: https://github.com/appcelerator/titanium_mobile/pull/9447 To test, you need to enable CloudKit. I probably did this the hard way, but here goes. 1. Open the Titanium.xcodeproj in the installed SDK and enabled iCloud under Capabilities 2. Add the following Entitlements.plist file to the ROOT of your Titanium project directory:
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
       	<key>com.apple.developer.icloud-container-identifiers</key>
       	<array>
       		<string>iCloud.$(CFBundleIdentifier)</string>
       	</array>
       	<key>com.apple.developer.icloud-services</key>
       	<array>
       		<string>CloudDocuments</string>
       	</array>
       	<key>com.apple.developer.ubiquity-container-identifiers</key>
       	<array>
       		<string>iCloud.$(CFBundleIdentifier)</string>
       	</array>
       	<key>com.apple.developer.ubiquity-kvstore-identifier</key>
       	<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
       </dict>
       </plist>
       
    3. Add iCloud to your distribution provisioning profile and regenerate/install it 4. Package your app for ad hoc or the app store Note that you need to specify an \-\-output\-dir when testing an app store build.
  2. Eric Wieber 2017-09-20

    FR Passed, using: MacOS 10.12.6 (16G29) Ti SDK 6.3.0.v20170919115035 Appc NPM 4.2.9 Appc CLI 6.2.4 Alloy 1.9.14 Xcode 9.0 (9A235) Able to package projects using CloudKit for adhoc and app store without issue.
  3. Eric Wieber 2017-09-21

    Verified in SDK builds 6.3.0.v20170920151245 & 7.0.0.v20170920153129

JSON Source