1

私は iOS 6.1 向けに開発を行っており、Core Data について学習しています。

文字列を詰め込んだ管理オブジェクト abc.myString があります。

abc.myString = @"the String";

変数領域に abc.myString が表示されている場合、内部を見ると NSManagedObject しか表示されず、さらに掘り下げると、理解できないものがたくさん表示されますが、文字列は表示されません。

しかし、abc.myString を読み込んだ後、これを実行して、何を入力したかを確認できます。

NSLog( @"contents = %@", abc.myString );

これは予想される動作ですか。変数領域の abc.myString に見えないのですか?

4

2 に答える 2

0

はい、Xcode は管理対象オブジェクトの内容を変数リストに表示しませんが、右クリックして使用Print Description of 'xyz'すると、内容をコンソールに出力できます。

于 2013-09-03T10:20:05.270 に答える
0

Yes, this is expected behaviour. NSManagedObject doesn't store its' fields in instances variables. Think of NSManagedObject as a front end to the persistent store's data. NSManagedObject doesn't actually store the data it fetches and update the persistent store.

You can still access the data by using the debugger. In the console type the follow to log an object:

po variableNameOrAddressOfTheObjectYouWantToLog

You can also set up break points to do this logging automatically.

于 2013-09-03T10:29:17.297 に答える