小编Mum*_*reg的帖子

通过GameKit将游戏数据保存到iCloud中

我正在尝试通过下一个代码将游戏数据保存到iCloud:

GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer saveGameData:[NSData dataWithBytes:rawData->data() length:rawData->size()]
                 withName:[NSString stringWithUTF8String:fileName.c_str()]
        completionHandler:^(GKSavedGame *savedGame, NSError *error) {
            if (error == nil) {
                DebugLog(@"Snapshot successfully saved");
            } else {
                DebugLog(@"saveSnapshot error: %@", error.description);
            }
        }];
Run Code Online (Sandbox Code Playgroud)

但收到错误消息: The requested operation could not be completed because you are not signed in to iCloud

我试过在iOS模拟器和设备上做这个但是没有成功.
并尝试使用测试苹果ID,开发苹果ID,新苹果ID,但也没有成功.
用户在iOS设置中登录iCloud并登录到Game Center.

有什么建议?

gamekit ios icloud

6
推荐指数
1
解决办法
1960
查看次数

标签 统计

gamekit ×1

icloud ×1

ios ×1