【求助】GameCenter上传成绩

请把代码粘贴在这里


```
公司现在有个单机游戏项目 要求分数能够上传gamecenter
我是小白 没开发过ios 用苹果官网上的函数就报错
具体如下:
上传用的函数



//上传分数
- (void) reportScore: (int64_t) score forLeaderboardID: (NSString*) identifier
{
    GKScore *scoreReporter =  initWithLeaderboardIdentifier: identifier];
    scoreReporter.value = score;
    scoreReporter.context = 0;
 
    NSArray *scores = @;
    [GKLeaderboard reportScores:scores withCompletionHandler:^(NSError *error) {
 //Do something interesting here.
    }];
}


排行榜我已经创建了,在.mm里面调用

CCUserDefault *pUser = CCUserDefault::sharedUserDefault();
    int score = pUser->getIntegerForKey("totalScore");
     reportScore:score forLeaderboardID:@"0001"];


错误信息:
2013-10-14 17:54:00.208 Inkcut.temp_caseinsensitive_rename -: unrecognized selector sent to instance 0x999f3a0
2013-10-14 17:54:00.217 Inkcut.temp_caseinsensitive_rename *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-: unrecognized selector sent to instance 0x999f3a0'
*** First throw call stack:
(0x2f1f012 0x250de7e 0x2faa4bd 0x2f0ebbc 0x2f0e94e 0x5558d 0x1eb179 0x9fc83 0x9bdb4 0x9be06 0x1336f4 0x133dc2 0x133e06 0xc04b8 0xd2bfc 0x148833f 0x1488552 0x14663aa 0x1457cf8 0x329fdf9 0x329fad0 0x2e94bf5 0x2e94962 0x2ec5bb6 0x2ec4f44 0x2ec4e1b 0x329e7e3 0x329e668 0x145565c 0x3046 0x2c16725 0x1)
libc++abi.dylib: terminate called throwing an exception

求各位大神指点
不甚感谢

:2: 不能沉了啊 自顶一发

估计方法写错地方了吧。cpp文件里面不能调用苹果自带的东西,mm里面可以调用c++的方法,用这个思想的话:定义一个全局方法,在mm里面实现,调用苹果的东西就好了。其他类似的都一样

  • (void) reportScore: (int64_t) score forCategory: (NSString*) category
    {
    GKScore *scoreReporter = initWithCategory:category];
    scoreReporter.value = score;

    [scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
    if (error != nil)
    {
    // handle the reporting error
    NSLog(@“上传分数出错.”);
    //If your application receives a network error, you should not discard the score.
    //Instead, store the score object and attempt to report the player’s process at
    //a later time.
    }else {
    NSLog(@“上传分数成功”);
    }

    }];
    }

仅供参考 然后我又在即写了一个mm的类调用这个卸载gamekit的类 然后在c++中直接调用mm中的类 。mm中的函数是用于中转的

求问 排行榜 创建以后 怎么 显示的? 我测试的 时候显示不出来 说 无项目

如何上传一个浮点型分数呢?

楼主有进展了吗?????同问