CoreDataのモデルクラスはXcodeのモデルエディタから自動生成しますが、生成されたクラスにメソッドを追加したりしたいことがあると思います。 そのとき、自動生成されたファイルを直接変更してしまうと、モデルに変更がありモデルクラスを再生成したときにその変更が上書きされてしまいます。 そこで、カテゴリを使って追加部分は別のファイルに分けておくと、モデルクラスを再生成しても後から追加した部分は上書きされずに残るのでそのまま使えます。 例えば下記のようなクラス (Event.h) があるとして、条件でフェッチするメソッドや、日付をフォーマットして返すメソッドを Event+CoreData.h/m や Event+Formatter.h/m として別ファイルに定義します。 // Event.h #import <Foundation/Foundation.h> #import <CoreDa
Mac Dev Center: Core Data Programming Guide: Core Data Performance この中の "Analyzing Fetch Behavior with SQLite" に、コマンドライン引数に次を指定すると CoreDataから SQLite へ発行される SQL をデバッグ出力できるとの記述があった。 -com.apple.CoreData.SQLDebug 1 やってみよう。 実行可能ファイルの設定を開く。 「起動時に渡される引数」に上記の引数を追加する。 実行する。以下、例。 2009-10-05 06:50:48.557 OneLiner[1202:207] CoreData: sql: SELECT COUNT(*) FROM ZMEMO t0 2009-10-05 06:50:48.558 OneLiner[1202:207
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く