iCloud turned on in Xcode, but not app store connect. How to fix?

孤街浪徒 提交于 2020-01-25 02:23:07

问题


I have been struggling to get my iOS app to enable iCloud.

I have followed documentation and have switched on iCloud with CloudKit in my project in Xcode.

But, when I then upload the app to App Store Connect from Xcode, iCloud is not there. It does not show up under "Capabilities" and in using the app through TestFlight, iCloud is not enabled.

Is there something special I need to do? Using Xcode version 10.1 + Mac OS High Sierra 10.13.

Note: there is a bunch of detail below. If you want to skip the detail, the summary is that I have followed the straight forward route to enabling iCloud, but it is not yet showing up in App Store Connect or on device through TestFlight.


Steps:

I have followed documentation and tried a few solutions like here and here.

1) I open my project in xcode.

2) In the xcode Capabilities pane, I switch on iCloud, check CloudKit, and use default container (a container named: "iCloud.com.[bundle identifier]").

3) At developer.apple.com, I verify that the app Id I am using has automatically enabled iCloud and CloudKit (it shows as green there).

4) At developer.apple.com, create a provisioning profile using that app id. iCloud is listed among the "Enabled Services" for this profile.

5) Back in xcode, in the General pane, turn off automatically manage signing and select this provisioning profile. If I select "automatically manage signing", it uses an "iPhone Developer" account for the signing certificate, which seems incorrect; when I do manual signing and select the updated prov profile, the Signing Certificate correctly reads "Iphone Distribution: [team name]"

6) Archive app: product -> archive. (I have double-checked here that iCloud remains selected in the Capabilities pane, without error)

7) Upload app: window -> organizer -> select archive, click distribute app, and take it from there.

Result: Build gets uploaded to App Store Connect successfully, but no iCloud support anywhere to be seen.

What else do I need to do?

NOTES:

When I archive the app, the entitlements file (listed under AppName -> AppName -> AppName.entitlements), includes this:

<dict>
    <key>aps-environment</key>
    <string>development</string>
    <key>com.apple.developer.icloud-container-identifiers</key>
    <array>
        <string>iCloud.$(CFBundleIdentifier)</string>
    </array>
    <key>com.apple.developer.icloud-services</key>
    <array>
        <string>CloudKit</string>
    </array>
    <key>com.apple.developer.ubiquity-kvstore-identifier</key>
    <string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
</dict>
</plist>

The aps-environment says "development". I have tried archiving and uploading this way, and it hasn't worked to enable icloud in App Store Connect. I have also tried manually switching this to "production" and archiving/uploading--but the result was the same there too.

--The underlying app is made with Nativescript, but I don't think that should matter for this stage, as I am uploading through xcode. (I have already gone through Nativescript info on this.)

--when I go into cloudkit dashboard, the Container says "in development". I haven't seen a way to change that without error


回答1:


It's a very long story, therefore, it's hard to follow and get the whole picture, but base on your comments...

It seems that you are missing the console Cloud activation somehow. I guess you may be mixing the development and distribution profiles.

My advice now that you're moving to the App Store Connect is move EVERYTHING to Production environment and if you haven't, update the profiles/provisionings.

I quote

On the cloud kit dashboard, each container will have a blue box for the Development environment and green box for the Production environment.

You can create and delete record types on the fly in the (blue) Development environment. But once you deploy to the (green) Production environment, that schema becomes permanent in that container. You can't delete record types from the (green) Production environment.

Deleting is harsh...

Try this approach and let me know if I hit the spot! ;) If I didn't, don't vote my down just jet lol, comment and I'll try to help you further.

This tutorial is pretty well known but I consider it's great for iCloud first comers, check it out if you haven't: https://www.raywenderlich.com/1000-cloudkit-tutorial-getting-started

Good luck!




回答2:


I've figured out the essential issue here: I was confusing what is, basically, two different iClouds (or at least two very different ways to use iCloud as a developer).

This will be obvious to many/most people familiar with iOS programming, but it was the key point I did not grasp.

Without this information, I was thrown off by some people saying iCloud just "automatically works", while others would go into depth about the need to do configuration. They both were right--just talking about different things.

So this is what I did not grasp before: These are the two different uses of iCloud from the developer perspective:

1) Automatic, backup iCloud. This is the system-wide feature, that allows users to back up data from their device. Users turn it on through turning on “iCloud Backup” (settings --> apple id --> iCloud). Once on, the device automatically backs up the user's data regularly. This feature will automatically back up data from your app that is included in the app/Documents directory. Further info here.

See here for details on preventing certain data from being backed up if you want.

Other than putting data you want backed up in the system wide back up in the documents director, there is nothing you as an app developer need to do. You do not even need to enable iCloud through Xcode (I think--though others please correct me if I am wrong).

This will not load data from iCloud onto your app when the app is loaded. Rather, it saves a backup (of your app data and the other data on the user's phone)--the main benefit of which is that if the user loses their device they can recover that data on a different device.

2) App specific cloud storage through iCloud. This affirmatively does not happen automatically, and requires meaningful configuration.

This is where you can use iCloud like a backend cloud solution. For example, you can send specific data to iCloud when that data is created, and then later get that data from iCloud onto the app when the user loads the app (instead of storing that data locally on the user's device).

This is where CloudKit comes in.

To enable this, you need to generate the proper entitlements file--such as enabling iCloud w/ CloudKit on Xcode, and being sure the app id and provisioning profile confirm that CloudKit is enabled. For a bit more detail, see my steps 1 through 7 in my question. This should work to get things "enabled".

But that is just the first piece, you then need to get things "configured". To do this, you likely have to do some configuration of the container that CloudKit generates for your app, and add code specific to the backend process in your app. There is some good info in the tutorial linked in the prior answer.

Thanks to those who gave info on this, including Apple Developer Technical Support.



来源:https://stackoverflow.com/questions/54813591/icloud-turned-on-in-xcode-but-not-app-store-connect-how-to-fix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!