2012-03-04 6 views
0
これはこれを理解しようとする狂気私を運転されています

を働いていない永続ストアへの更新...私はレコードが好きなコアデータ -

あるフラグに属性を設定する必要があり、管理対象オブジェクトを持って

問題は、私は値がデータベースに保存されて表示されていないということです(私はシミュレータからデータベースを引っ張って、それを検査している???)

次のコードスニペットです...何のエラーに注意してくださいません保存からスローされます

// Tell the user we have added to favorites 

NSString *yes = @"Y"; 

[cardMessage setValue:yes forKey:@"favorite"]; 

NSError *error = nil; 
BOOL savedSuccessfully = [managedObjectContext save:&error]; 
if (!savedSuccessfully) 
{ 
    /* 
    Replace this implementation with code to handle the error appropriately. 

    abort() causes the application to generate a crash log and terminate. 
     You should not use this function in a shipping application, although it 
     may be useful during development. 
    */ 
    NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 
    abort(); 
} 

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil 
     message:@"Message added to Favorites" delegate:self 
     cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
[alert show]; 

答えて

0

SQLite Manager(ブラウザプラグイン)を使用して、Simulator db - fast and easy(Firefoxプラグ)からデータを表示できます。 https://code.google.com/p/sqlite-manager/ - (BOOL)hasChanges - 予期しないことが起こった場合(たとえば変更なし)に備えてください。

+0

Firefoxのプラグインを使用してデータを表示しています...なぜ更新が反映されないのか混乱しています – rs2000

+0

変更が発生した場合はログに記録するために次を追加しました。変更は%@ \ n "、([managedObjectContext hasChanges]?@" YES ":@" NO "))); - 結果はNOだった! ...管理対象オブジェクトが更新された後だったのですが...近づいているかもしれないと思います...ありがとう – rs2000

+0

これはまだ私を狂っています...基本的なものは間違っています....私は今書いていますレコードを再読み込みしてパラメータを更新するいくつかのロジック...コードはすべて動作しますが、データはデータベースに保存されません。コードは – rs2000