我碰到一個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
我已添加該信息! :)哎呀抱歉,你說分數陣,我以爲你說的是分類。我會在一分鐘內補充一點。 –
好吧,我現在添加了這個信息 –