MrStahlfelge / gdx-gamesvcs

Easy integration of gameservices in your libGDX game: Google Play Games, Apple Game Center, Amazon GameCircle and more
Apache License 2.0
113 stars 20 forks source link

GameCenter Cloud save error 27 #29

Closed MrStahlfelge closed 4 years ago

MrStahlfelge commented 5 years ago

When activitating cloud save for Apple Game Center, it does not work and the following error is printed to console output:

Error Domain=GKErrorDomain Code=27 "The requested operation could not be completed because you are not signed in to iCloud" UserInfo=0x1889f160 {NSLocalizedDescription=The requested operation could not be completed because you are not signed in to iCloud}

The player is signed in. All other parts of Game Center are working fine in the game.

Same issue as in https://forums.developer.apple.com/thread/112716

UnbackedFan commented 4 years ago

Thanks for the great framework. I am also getting the error 27 when trying to save to cloud on iOS.

I made sure the iCloud capabilities are enabled on the Certificates, Identifiers & Profiles page. I also made sure I am signed in on iCloud on the iOS device and that the iCloud drive is on. The only things I'm not sure about is this: Please note that you have to enable "iCloud Documents" for this to work, otherwise calling this method will log debug error code 27.

Where exactly do I do this?

manutyagi01 commented 4 years ago

Thanks for the great framework. I am also getting the error 27 when trying to save to cloud on iOS.

I made sure the iCloud capabilities are enabled on the Certificates, Identifiers & Profiles page. I also made sure I am signed in on iCloud on the iOS device and that the iCloud drive is on. The only things I'm not sure about is this: Please note that you have to enable "iCloud Documents" for this to work, otherwise calling this method will log debug error code 27.

Where exactly do I do this?

xcode project > Signing and Capabilities

UnbackedFan commented 4 years ago

Thanks for the great framework. I am also getting the error 27 when trying to save to cloud on iOS. I made sure the iCloud capabilities are enabled on the Certificates, Identifiers & Profiles page. I also made sure I am signed in on iCloud on the iOS device and that the iCloud drive is on. The only things I'm not sure about is this: Please note that you have to enable "iCloud Documents" for this to work, otherwise calling this method will log debug error code 27. Where exactly do I do this?

xcode project > Signing and Capabilities

I am using intelliJ + robovm plugin to develop the app. I do not have an xcode project setup.

manutyagi01 commented 4 years ago

You will probably need to add an entitlements.plist file and include the relevant details inside this plist file. (take a look inside a entitlements file created in a xcode project) <string>CloudDocuments</string>

also adding this line to you robovm.xml <iosEntitlementsPList>Entitlements.plist</iosEntitlementsPList>

MrStahlfelge commented 4 years ago

Thanks, will try! Is the problem solved for you now?

manutyagi01 commented 4 years ago

Thanks, will try! Is the problem solved for you now?

Yes it is. If this information is required for everyone using cloud saves it would be useful in the wiki I imagine.

This will also probably be required in the plist file if you get the relevant errors uploading to apple connect.

<dict>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.icloud-container-environment</key>
<array>
<string>Production</string>
</array>
UnbackedFan commented 4 years ago

I tried copy pasting the Entitlements.plist file generated by xcode into my libgdx project but now I am encountering compilation errors. This is what my file looks like. Could you show me what yours look like?

<?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>aps-environment</key>
        <string>development</string>
        <key>com.apple.developer.icloud-container-identifiers</key>
        <array>
            <string>iCloud.com.test.test</string>
        </array>
        <key>com.apple.developer.icloud-services</key>
        <array>
            <string>CloudDocuments</string>
            <string>CloudKit</string>
        </array>
        <key>com.apple.developer.ubiquity-container-identifiers</key>
        <array>
            <string>iCloud.com.test.test</string>
        </array>
<!--        <key>com.apple.developer.ubiquity-kvstore-identifier</key>-->
<!--        <string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>-->
    </dict>
</plist>
manutyagi01 commented 4 years ago
<?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>aps-environment</key>
    <string>production</string>
     <key>com.apple.developer.icloud-container-environment</key>
     <array>
         <string>Production</string>
     </array>
    <key>com.apple.developer.icloud-container-identifiers</key>
    <array>
        <string>iCloud.com.test.test</string>
    </array>
    <key>com.apple.developer.icloud-services</key>
    <array>
        <string>CloudKit</string>
        <string>CloudDocuments</string>
    </array>
    <key>com.apple.developer.ubiquity-container-identifiers</key>
    <array>
        <string>iCloud.com.test.test</string>
    </array>
</dict>
</plist>
UnbackedFan commented 4 years ago

I see that the aps-environment key is used for Apple Push Notification service, is this required to get iCloud saving to work?

Edit: Nevermind, it seems to be working now. I did not need the aps-environment. I recreated my provisioning profiles and it's working. Thanks for your time.

MrStahlfelge commented 4 years ago

Hi, it's been some time but I've found the time to look at this problem again. I wanted to fix this in my game and add a guide to the wiki on how to enable Cloud Save, however, I wasn't successful and stil get error 27.

Here is what I've done:

Added <iosEntitlementsPList>Entitlements.plist.xml</iosEntitlementsPList> to robovm.xml.

Copied xcodes entitlements file to the given file name. The file looks pretty same than your files, just the bundle identifier is changed. The capabilities for CloudDocuments were already given, I've added CloudKit as well. The capabilities are also granted in my provisioning profiles.

Compile and deploy on a Simulator with a user signed in to Game Center and iCloud. Still getting error 27.

Now I am not sure: doesn't this work on a Simulator? Or have I overseen something? Thanks!

manutyagi01 commented 4 years ago
MrStahlfelge commented 4 years ago

I hope the problem is just because of the simulator, unfortunately I don't have the possibility to test on a real device. I referenced this issue from the wiki article and will close it now just hoping it is solved for everyone this way.

Thanks again for your answer and help!

MrStahlfelge commented 4 years ago

I can confirm it is working now.

In Appstoreconnect, there is now also a lot of information regarding iCloud written on the build details. That was missing before, but how should one now that there should be something. :D

Thanks again for the information here 👍

PromanSEW commented 3 years ago

Hi, I am still getting this error after all settings. Please help me. The last thing I can't find is container fields configuration for GKGameSave Please give screenshot of your iCloud container record types and fields