ios - 如何使用 Core Data 存储游戏的最佳分数 (iOS)

标签 ios core-data

我查看了一些SO问题(for example)..

不过我一分都没有。我有一个应用程序可以测试人们学习另一种语言的能力。所以我对每个单词都有一个分数。

我可以从模型中读取数据,但我不知道如何设置增量值。

每种语言的每个单词都附有分数。想法会很棒。

现在,我的数据库模型是一个单一实体,如下所示:

enter image description here

我现在得到了正确的结果,但不知道如何处理它..

当我的大脑爆炸时,我还没有超越这一点。

-(void) incrementScore {
    NSLog (@"incrementScore");
     WordEntity * word = nil;

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    int languageKey = [defaults integerForKey:DEFAULT_KEY_LANGUAGE_NUMBER];

    if (languageKey == 0) {
        currentScore  = [word.greekScore integerValue];

    } else {
        currentScore = [word.englishScore integerValue];
    }



    if (languageKey == 0) {
        //NSNumber *tempNumber;
        //word.greekScore setValue:currentScore forKey:<#(NSString *)#>
       // word.greekScore = [word.greekScore +1 ];
        currentScore  = [word.greekScore integerValue];

    } else {
        currentScore = [word.englishScore integerValue];
    }
    currentScore = currentScore + 1;

最佳答案

新的 farmville age 方法是使用 gamecenter 而不是 用 coredata 大炮杀死一只苍蝇

我想这并没有回答你的问题,是吗

关于ios - 如何使用 Core Data 存储游戏的最佳分数 (iOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25039309/

相关文章:

ios - 核心数据 : How do you migrate an unversioned store?

ios - Swift 4 中的 AWS DynamoDB updateItem 问题

ios - 为 APNs 安全发送设备 token

ios - JSON 到核心数据 SQLITE 错误

ios - 怎么可能tableView :commitEditingStyle:forRowAtIndexPath: be called with a nil indexPath?

c++ - Cocos2dx 2.2.3 架构 arm64::WebPInitDecoderConfigInternal 的 undefined symbol

cocoa - 重命名时不会加载核心数据模型文件

ios - 具有复杂谓词的 NSFetchedResultsController

iphone - 应用更新后保留核心数据

core-data - Swift - 在应用程序组中共享核心数据模型(带扩展)