我是一個新手,所以我很抱歉,如果我失去了明顯的東西。爲什麼我不能識別數據庫中的簡單字符串鍵值(核心數據)
我正在嘗試在Xcode 4中編寫一個應用程序來爲我的本地運動隊製作統計數據。
這是我的程序的問題區域的相關細節:
NSError *error;
NSArray *games = [context executeFetchRequest:fetchRequest error:&error];
if (games == nil) {
NSLog(@"There was an error!");
}
int noOfBatOuts = games.count;
int noOfNotOuts=0;
for (NSManagedObject *oneMatch in games) {
if ([oneMatch valueForKey:@"batOut"][email protected]"NO") {
noOfBatOuts = noOfBatOuts - 1;
noOfNotOuts = noOfNotOuts + 1;
NSLog(@"Not Out!");
}
NSLog(@"How out %@",[oneMatch valueForKey:@"batOut"]);
}
notOuts.text=[NSString stringWithFormat:@"%d",(noOfNotOuts)];
NSLog(@"No of Not Outs is %@",notOuts.text);
當我有一個未出字符串數據運行 - 不, - 的的NSLog(@!「不出來」)是從來沒有調用過,最後的NSLog(@「No of Out Outs ...)報告爲零。但是我知道數據在那裏,它在中間的NSLog(@」How Out ....「)中被標識。
我開始沮喪地把我的頭髮撕掉,沒有知識還沒有知道答案。任何人都可以幫忙嗎?
相同的評論羅布 - 我的經驗不足表明,並感謝 –