【问题标题】:Server error when trying to report Achievement to GameCenter尝试向 GameCenter 报告成就时出现服务器错误
【发布时间】:2012-10-29 05:25:06
【问题描述】:

使用 Apple 提供的代码时,

- (void) reportAchievementIdentifier: (NSString*) identifier percentComplete: (float) percent
{
    GKAchievement *achievement = [[[GKAchievement alloc] initWithIdentifier: identifier] autorelease];
    if (achievement)
    {
  achievement.percentComplete = percent;
  [achievement reportAchievementWithCompletionHandler:^(NSError *error)
   {
    if (error != nil)
    {
     NSLog(@"problem with reporting");
     NSLog(@"%@",[error localizedDescription]);
     // Retain the achievement object and try again later (not shown).
    }
   }];
    }
}

我得到错误:

由于与服务器通信时出错,请求的操作无法完成。

我已经验证了用户,并且似乎注册了我玩过游戏,但它无法记录成就。有什么想法吗?

【问题讨论】:

    标签: iphone objective-c game-center


    【解决方案1】:

    尝试使用 Apple 的可达性示例应用程序来确定 iPhone 是通过 wifi 还是 3G 连接到互联网。 http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

    【讨论】:

    • 您好,谢谢,我已连接到互联网,事实上,如果我使用来自苹果的此身份验证命令,我就是经过身份验证的播放器- (void) authenticateLocalPlayer { [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) { if (error == nil) { NSLog(@"玩家已通过身份验证"); // 在此处插入代码以处理成功的身份验证。 } else { NSLog(@"玩家尚未通过身份验证"); // 您的应用程序可以处理错误参数以向播放器报告错误。 } }]; }
    • 我没有看到任何东西。嗯。也许成就会在处理程序收到回调之前自动释放?也许尝试保留它?
    【解决方案2】:

    itunesconnect 的成就需要几分钟才能传播到服务器。 稍后再试,卸载重装也无妨。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-09
      • 2021-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-28
      相关资源
      最近更新 更多