Help us understand the problem. What is going on with this article?

CoreDataのSQLを出力する

More than 5 years have passed since last update.

SQLiteを永続ストアにしている環境で、CoreDataがどんな風にアクセスしているか知りたかったので設定してみました。

ターゲット選択のプルダウンからEdit Schemeを開く

スクリーンショット 2014-06-18 14.25.03.png

Argumentsを開く

Runを選択してArgumentsタブを開く。

kobito.1403069314.205745.png

引数を追加

下にある+ボタンをクリックしてアプリケーション起動時の引数を追加。引数の内容は次のようにする。

-com.apple.CoreData.SQLDebug 1

kobito.1403069652.169031.png


以上で次回起動時にデバッグログが出力されるようになる。

2014-06-18 13:17:03.601 xxx[31065:60b] CoreData: sql: SELECT t0.Z_ENT, t0.Z_PK, Z_FOK_REPORT FROM ZLMABSTRACTREPORTCONTENTOBJECT t0 WHERE  t0.ZREPORT = ? 
2014-06-18 13:17:03.601 xxx[31065:60b] CoreData: details: SQLite bind[0] = (int64)41
2014-06-18 13:17:03.602 xxx[31065:60b] CoreData: annotation: sql connection fetch time: 0.0004s

参考

key
Python + Djangoでウェブ・アプリケーション開発、SwiftでiOSアプリ開発をやってます。
http://blog.mitsukuni.org
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした