Scores in game center wont add does anyone know what's wrong with it?
Counter = in the .header file ;
int counter;
And the .m file looks like;
Code:
- (IBAction) subScore{
GKScore *scoreReporter = [[GKScore alloc] initWithCategory:@"1234567"];
scoreReporter.value = counter;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil)
{
NSLog(@"Failed: %i",counter);
} else {
NSLog(@"Succes: %i",counter);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Thanks"
message:@"Score is added! Play again." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
}];
}
The NSLogs is giving me the succes with a score.
**Is it possible to add a score to game center in sandbox mode?**
------
2;
I also tried;
Code:
- (void) reportScore: (int64_t) counter forCategory: (NSString*) category
{
GKScore *scoreReporter = [[GKScore alloc] initWithCategory:@"1234567"];
scoreReporter.value = counter;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil)
{
NSLog(@"Failed: %lld", counter);
}
}];
}
This is giving me an error (crash);
Code:
> 2012-01-07 04:09:03.574 [1475:707] Succes (viewdidload) 14 2012-01-07
> 04:09:05.907 [1475:707] -[score subScore]: unrecognized selector sent
> to instance 0x1eddb0 2012-01-07 04:09:05.912 [1475:707] ***
> Terminating app due to uncaught exception
> 'NSInvalidArgumentException', reason: '-[score subScore]: unrecognized
> selector sent to instance 0x1eddb0'
> *** First throw call stack: (0x340188bf 0x342681e5 0x3401bacb 0x3401a945 0x33f75680 0x33f72435 0x373dc9eb 0x373dc9a7 0x373dc985
> 0x373dc6f5 0x373dd02d 0x373db50f 0x373daf01 0x373c14ed 0x373c0d2d
> 0x307f3df3 0x33fec553 0x33fec4f5 0x33feb343 0x33f6e4dd 0x33f6e3a5
> 0x307f2fcd 0x373ef743 0x29c1 0x2958) terminate called throwing an
> exception(gdb)