I have this method which will report a score to game center:
- (void)reportScore: (int64_t) forCategory: (NSString*) category
{
GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:category] autorelease];
scoreReporter.value = passedint;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil)
{
// handle the reporting error
}
}];
}
Now I have an ibaction to try to call that method but I am not able to figure it out..
- (IBAction)uploadscore {
passedint = [[NSUserDefaults standardUserDefaults] integerForKey:@"Scoreoneplayer"];
NSLog(@"%i", passedint);
[self reportScore:(passedint)forCategory :(NSString *) category];
}
passedint is the int I want to upload to Game Center. 开发者_开发问答If anyone can help, that would be greatly appreciated! :)
This should do it:
[self reportScore: passedint forCategory: @"Put your category here"];
You shouldn't need to provide types in the method call.
精彩评论