我碰到一个SIGABRT崩溃,有时会说崩溃:一个GKScore必须包含一个初始化值。GKScore必须包含初始值?
因此,跟踪它到这条线:
[localScore reportScoreWithCompletionHandler:^(NSError* error) {}];
而且localStore是这样创建的:
GKScore* localScore = [scores objectForKey:category];
- 类来自...
for (NSString* category in categories)
- - 类别来自...
[GKLeaderboard loadCategoriesWithCompletionHandler:^(NSArray *categories, NSArray *titles, NSError *error)
-(void) initScores
{
NSString* libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString* file = [libraryPath stringByAppendingPathComponent:currentPlayerID];
file = [file stringByAppendingString:kScoresFile];
id object = [NSKeyedUnarchiver unarchiveObjectWithFile:file];
if ([object isKindOfClass:[NSMutableDictionary class]])
{
NSMutableDictionary* loadedScores = (NSMutableDictionary*)object;
scores = [[NSMutableDictionary alloc] initWithDictionary:loadedScores];
}
else
{
scores = [[NSMutableDictionary alloc] init];
}
//NSLog(@"scores initialized: %d", scores.count);
}
对不起,所有的代码,但几乎所有这些代码都来自这个库文件:https://github.com/csddavies/DDGameKitHelper/blob/master/DDGameKitHelper.m
反正我将如何解决这一问题?
谢谢!
从哪里来的分数阵列? – rickster
我已添加该信息! :)哎呀抱歉,你说分数阵,我以为你说的是分类。我会在一分钟内补充一点。 –
好吧,我现在添加了这个信息 –