<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9077495448448724410</id><updated>2026-10-18T08:52:18.888+09:00</updated><category term="cocoa"/><category term="SimpleCap"/><category term="WebKit"/><category term="RubberBand"/><category term="画面キャプチャ"/><category term="coredata"/><category term="調査・検証"/><category term="ホットキー"/><category term="情報"/><category term="Cookie"/><category term="Keychain Service"/><category term="SimpleViewer"/><category term="プリファレンス"/><category term="ローカライズ"/><category term="本"/><category term="Core Image"/><category term="thinbutton"/><category term="Safari"/><category term="binding"/><category term="スクラップブック"/><category term="マルチスクリーン"/><category term="Quick Look APIs"/><category term="WPSU"/><category term="BlogAssistant"/><category term="ツールバー"/><category term="メニュー"/><category term="NSCell"/><category term="カスタムウィンドウ"/><category term="タイマーダイアログ"/><category term="Core Annimation"/><category term="TwitPic"/><category term="xcode"/><category term="吹き出し"/><category term="Application List"/><category term="Launch Services"/><category term="flash"/><category term="carbon"/><category term="ドラッグ＆ドロップ"/><category term="NSTableView"/><category term="objective-c"/><category term="tips"/><category term="起動アプリ"/><category term="アニメーション"/><category term="ASIHTTPRequest"/><category term="Dashboard"/><category term="FSEvent"/><category term="NSCollectionView"/><category term="ScriptingBridge"/><category term="WebKit Plug-in"/><category term="コンテキストメニュー"/><category term="CopyAndPaste"/><category term="NSFontManager"/><category term="NSFontPanel"/><category term="NSImage"/><category term="NSInvocation"/><category term="NSMenuItem"/><category term="NSViewAnimation"/><category term="NSViewController"/><category term="NSWindow"/><category term="NSWorkspace"/><category term="PDF"/><category term="Snow Leopard"/><category term="XML"/><category term="blocks"/><category term="git"/><category term="objective-c 2.0"/><category term="リリース"/><category term="今週のcocoa情報"/><category term="ADCサンプル"/><category term="GIMP"/><category term="HUD"/><category term="ImageKit"/><category term="KVC"/><category term="Localization"/><category term="NSApplication"/><category term="NSBezierPath"/><category term="NSEvent"/><category term="NSFileManager"/><category term="NSMatrix"/><category term="NSOpenPanel"/><category term="NSPasteboard"/><category term="NSScreen"/><category term="NSTextField"/><category term="NSValueTransformer"/><category term="NSView"/><category term="NView"/><category term="Nib"/><category term="Pixelmator"/><category term="Plug-in"/><category term="RTFD"/><category term="SIMBL"/><category term="SQLite"/><category term="Sparkle"/><category term="TBXML"/><category term="category"/><category term="debug"/><category term="google"/><category term="undo"/><category term="zlib"/><category term="カテゴリ"/><category term="ソフト公開"/><category term="タブ"/><category term="プロパティ"/><category term="ローカリゼーション"/><category term="動画"/><title type='text'>(旧) Cocoaの日々</title><subtitle type='html'>MacOSXプログラミング。毎日更新。&#xa;話題： Cocoa, Objective-C, Snow Leopard</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://xcatsan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>883</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-1294091733291628261</id><published>2010-06-13T22:27:00.002+09:00</published><updated>2010-06-13T22:27:29.513+09:00</updated><title type='text'>サイトをリニューアルしました</title><summary type="text">新しいサイトはこちらです↓

Cocoaの日々

※このサイトは閉鎖せずに今後も公開しておきます。

長い間ありがとうございました。
よければ新しいサイトの方も訪問してみて下さい。

橋口</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1294091733291628261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1294091733291628261'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/blog-post_13.html' title='サイトをリニューアルしました'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-5100760638055659098</id><published>2010-06-12T14:34:00.001+09:00</published><updated>2010-06-12T14:35:37.605+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - トランザクション(5) まとめ</title><summary type="text">前回までの検証結果まとめ。

NSManagedObjectContext操作まとめ

 操作説明ディスク操作Undo/Redoの履歴 
 save現時点でのメモリの内容を保存する書き出しなし 
 rollbackディスク上の内容に戻す（必要なら）読み込みクリア 
 undo１つ前の操作を取り消す（操作直前の内容に戻す）なしなし 
 redo次の操作をもう一回行う（取り消した操作を復活）なしなし 
 resetメモリの初期化（変更の破棄、読み込まれたオブジェクトの破棄）なしクリア 

(参考)NSManagedObjectContext Class Reference - Undo Management

今まで検証に使ったソースは GitHub からダウンロードできる。
CoreDataTransaction at 2010-06-12 from xcatsan&#39;s </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/5100760638055659098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/5100760638055659098'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-5.html' title='CoreData - トランザクション(5) まとめ'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-1982480971452723430</id><published>2010-06-11T23:10:00.031+09:00</published><updated>2010-06-12T14:16:34.708+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - トランザクション(4) reset</title><summary type="text">-[NSManagedObjectContext reset] を試す。

コードを追加し、

- (IBAction)resetAction:sender{ [self.managedObjectContext reset];}
ボタンに紐づける。
実行。resetボタンを押すと、
データが消える。
これは NSManagedObjectContext（メモリ）上のデータが消えただけで、ディスク上のデータは残っている。

試しに reload ボタンを追加する。
ボタンが押されたら、NSArrayController を使っているので prepareContent を投げてみる。

- (IBAction)reloadAction:sender{ [arrayController prepareContent];}

すると reset で一旦消えた後、
reloadボタンで復活。

</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1982480971452723430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1982480971452723430'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-4-reset.html' title='CoreData - トランザクション(4) reset'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL0j3iLZJI1RMHAk5znLaSc43ybEBZ7kn6J8ywqyi625vLnpQ2PPoJZYASR8XgFHuqp2NI3XE7BiXdrlV0zq0GPGBL8Zz9nIgBwPXIboAJudsbiPczxsOc63D9CXchTrAQCjPdP5rLkNRQ/s72-c/100612-0020.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-6601945477371872404</id><published>2010-06-10T23:10:00.028+09:00</published><updated>2010-06-12T13:52:05.994+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - トランザクション(3) undo と redo</title><summary type="text">undo と redo をやってみる。

まずアクションメソッドを用意する。

- (IBAction)undoAction:sender{ [self.managedObjectContext undo];}- (IBAction)redoAction:sender{ [self.managedObjectContext redo];}

Interface Builder を開き、Undo/Redoのボタンを追加する。これを先程のメソッドに紐づける。
実行する。確かに Undo/Redo が効いている。なお標準でメニューのUndo/Redoが FirstResponderにひもづけられており、実は今回のボタンを用意しなくてもメニューから Undo/Redoが行えた。

save と rollback の関係だが次のようになっていた。
(1) save後、Undo/Redo操作 は</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/6601945477371872404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/6601945477371872404'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-3-undo-redo.html' title='CoreData - トランザクション(3) undo と redo'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhz27jLDQQFgw6teQeAc8qONc4l0FGw2hMvefo8pJ6vhKkhyWo9IHcpbOAzAtB6NscwjuHQZ5WtU-HBPQqOR8XNuLMUmd6MsP_JM79_jv0ZFGVx00ttym9wAUJVomPlKjBdcQj2zPXMrA32/s72-c/100612-0017.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-3042904027899992572</id><published>2010-06-09T23:01:00.001+09:00</published><updated>2010-06-12T08:10:04.615+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - トランザクション(2) rollback</title><summary type="text">rollback を試してみよう。前回のサンプルに Rollback ボタンを追加する。
rollback用のアクションコードを書き、そこへ紐づける。

- (IBAction)rollbackAction:(id)sender{ [self.managedObjectContext rollback];}

実行してみよう。
新規にレコードを追加し、入力したところで Rollback ボタンを押す。
すると新規レコードが取り消されるのがわかる。


複数の操作も試してみよう。
まず新規レコードを追加し
元からあったレコードを修正し
１レコード削除する
そして Rollback
元に戻った。</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/3042904027899992572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/3042904027899992572'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-2-rollback.html' title='CoreData - トランザクション(2) rollback'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJFVnDNf3R-IxQZ0sj63SXFwJsrBLmnZnTJkyF_KDT4rq9RIshwk4c6Pfj4lQem9TLmpeowY1zBv3pt3AJbZJQdMZOufdO0ncPWvaUOiBRWpmb7EwCJ22jLh5FJ6wz5wd6bilDy73NSzpy/s72-c/100612-0010.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-7665934989494723213</id><published>2010-06-08T07:28:00.107+09:00</published><updated>2010-06-12T08:00:53.254+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - トランザクション(1) 準備</title><summary type="text">CoreData のトランザクションについて調べてみる。

NSManagedObjectContext では Undo Management としていくつかメソッドが用意されている。
NSManagedObjectContext Class Reference - Undo Management

これらの挙動を試す簡単なサンプルプログラムを組んでみよう。
今回はまずレコードの表示、追加、削除、変更ができるプログラムを組む。


まず　Xcodeで新規プロジェクトを作る。このとき &quot;Use Core Data for storage&quot; にチェックを入れておく。
続いてモデルを定義する。今回は Book というシンプルなエンティティを一つ用意した。

ビューを用意する。NSTableView を作り author と titile 列を作る。
モデルとビューの紐付けに </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/7665934989494723213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/7665934989494723213'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-1.html' title='CoreData - トランザクション(1) 準備'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyOj_JSXfKC1cLu3W5Z0OC3pzDA4G72rDuPh9LXbGgTwRY_V3_GF9Tkzix-2me2KsXKoSkBPaE_4tLL6h5LMyRiznMXsBfsNgzltX8Iom7D2DhYxMgUMjwGmRIPgim81Q2SCbCysHZosrt/s72-c/100612-0001.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-3692328143645189395</id><published>2010-06-07T23:50:00.000+09:00</published><updated>2010-06-11T15:53:46.846+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="カテゴリ"/><title type='text'>カテゴリでクラスメソッド定義</title><summary type="text">カテゴリはクラスメソッドもいける。

こうなら、

@interface Customer (Extension)+(void)hello;@end


+(void)hello{ NSLog(@&quot;hello&quot;);}

普通に呼び出せる。


[Customer hello];


ファクトリメソッドなどの追加に使えそうだ。

- - -
近日ブログのリニューアル予定（URLが変わります）。</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/3692328143645189395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/3692328143645189395'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/blog-post.html' title='カテゴリでクラスメソッド定義'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-82634317249345355</id><published>2010-06-06T23:46:00.000+09:00</published><updated>2010-06-10T12:00:05.963+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="情報"/><title type='text'>今週のCocoa情報(6/6) - 今週気になった Cocoaプログラミング情報の紹介</title><summary type="text">what are alternatives to throwing exceptions in objective c - Stack Overflow
@throw よりも NSError を使う方が &quot;the Apple recommended pattern&quot; とのこと。確かに Cocoa Framework では例外より NSErrorを使う方が多い。


iPhone開発で便利なcocoa.vim - hellkite 日記と雑記とメモ。
MacVimとcocoa.vimで世界が変わった - Meltdown Countdown
VimでCocoa開発する話題。普段 PHPアプリなどは vimを使っているので気になる。


Cocoa nonatomic properties - Stack Overflow
プロパティ設定で &quot;nonatomic&quot;をつけない場合、ロック/アン</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/82634317249345355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/82634317249345355'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/cocoa66-cocoa.html' title='今週のCocoa情報(6/6) - 今週気になった Cocoaプログラミング情報の紹介'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-4324642871205226783</id><published>2010-06-05T23:18:00.016+09:00</published><updated>2010-06-07T23:36:40.945+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - Object ID（その５）情報</title><summary type="text">（前回）Cocoaの日々: CoreData - Object ID（その４）Object ID から NSManagedObject を取得する #2

NSManagedObjectID についての情報など。


NSManagedObjectID into NSData - Stack Overflow

NSURL へ変換後、NSKeyedArchiver を使い NSData へ格納。



Cocoa with Love: Safely fetching an NSManagedObject by URI

NSManagedObjectIDに関して簡潔だがわかりやすい説明。URIから NSManagedObject を取得するカテゴリを紹介している。

@implementation NSManagedObjectContext (FetchedObjectFromURI)</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/4324642871205226783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/4324642871205226783'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-object-id_05.html' title='CoreData - Object ID（その５）情報'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-6035643767278988557</id><published>2010-06-04T23:36:00.009+09:00</published><updated>2010-06-05T03:23:48.120+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - Object ID（その４）Object ID から NSManagedObject を取得する #2</title><summary type="text">（前回）Cocoaの日々: CoreData - Object ID（その３）Object ID から NSManagedObject を取得する


Object ID から NSManagedObject を取得するメソッドは、前回の -[objectWithID:] を含め３つある。

クラス：NSManagedObjectContext
- (NSManagedObject *)objectWithID:(NSManagedObjectID *
- (NSManagedObject *)objectRegisteredForID:(NSManagedObjectID *)objectID
- (NSManagedObject *)existingObjectWithID:(NSManagedObjectID *)objectID error:(NSError **)error
</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/6035643767278988557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/6035643767278988557'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-object-idobject-id_04.html' title='CoreData - Object ID（その４）Object ID から NSManagedObject を取得する #2'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-7110433488150116211</id><published>2010-06-03T23:14:00.019+09:00</published><updated>2010-06-05T02:25:31.890+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - Object ID（その３）Object ID から NSManagedObject を取得する</title><summary type="text">Object ID の URI から NSMangedObject を取得することができる。ステップは２つ。

(1) -[NSPersistentStoreCoordinator managedObjectIDForURIRepresentation:] を使い、NSManagedObjectID を取得する
(2) -[NSManagedObjectContext objectWithID:] に(1)の結果を渡し、NSManagedObject を取得する。

NSPersistentStoreCoordinator Class Reference - managedObjectIDForURIRepresentation:

NSManagedObjectContext Class Reference - objectWithID:

やてみよう。

サンプル：</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/7110433488150116211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/7110433488150116211'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-object-idobject-id.html' title='CoreData - Object ID（その３）Object ID から NSManagedObject を取得する'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhro1IeVpflSyl5keBNIJGtloZ-TSN2XCM_I9p3MpWZGp6oUtKFLwbBAonsAKgRhP-boMWit6fdC9WxqHZKLzCSMeFGene1Pw2btWPfuXqvEQjFYhb27o9KOU86wWYsjlB3WVGhGRC_mDUS/s72-c/100605-0008.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-988776827712271664</id><published>2010-06-02T23:32:00.034+09:00</published><updated>2010-06-05T01:53:12.294+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - Object ID（その２）モデルのバージョンを変える</title><summary type="text">モデルのバージョンを変えると Object ID は変化するのか？試してみた。


バージョンを追加後(v2)、createdを追加した。


マッピングモデルを追加し、現在のバージョンを先程追加したもの(v2)に設定する。
 
（参考）Cocoaの日々: CoreData - マイグレーション

ビルド後に実行してみる。
（なお実行時にエラーが出る場合は、クリーニングしたのち再ビルドすると良い）。


結果は変わらず。これはまあ当然か。
１レコード追加してみる。
UUIDの部分（677CA547-...）は変わらないようだ。モデルのバージョンによって変化しないことがわかった。


SQLite DB の中身。
sqlite＞ select * from z_metadata;
1|677CA547-4D80-417A-8810-70847FB0375D|bplist00?
</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/988776827712271664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/988776827712271664'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-object-id.html' title='CoreData - Object ID（その２）モデルのバージョンを変える'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgusWaBHErh-K7I64UrTph_Uk8rcKR0mJPlPk8QgM1HPhiTQu_G_vl9PTQRq1sPuftdjUVXxy16cjHNBg10Cfi4EGNaoFVN7xQ74crBt6xbiCvXDwvY80HTpY48J78AODJYe08UbSXAmrSx/s72-c/100605-0004.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-1875578833123502252</id><published>2010-06-01T23:54:00.054+09:00</published><updated>2010-06-05T01:34:01.474+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - Object ID（その１）NSManagedObjectID</title><summary type="text">NSManagedObject の Object ID
NSManagedObjectには、オブジェクトを一意に識別する為にObject ID割り振られている。この ID は NSManagedObjectID型として定義されていて、-[NSManagedObject objectID] で取得できる。

NSManagedObject Class Reference - objectID 


NSManagedObjectID
このNSManagedObjectIDは次のメソッドを持っている。
- (NSEntityDescription *)entity
- (BOOL)isTemporaryID
- (NSPersistentStore *)persistentStore
- (NSURL *)URIRepresentation
NSManagedObjectID Class </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1875578833123502252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1875578833123502252'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/06/coredata-object-idnsmanagedobjectid.html' title='CoreData - Object ID（その１）NSManagedObjectID'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO3DI79YW_EKzwk32P3Nn81FvXyTXf3kh8TQXV5Qz4nlk6aWYJMOv3JL3EMWt8Bn7q96H4K5MGujeRLBrm7jOIrKK-djRB1IOTS5NVLAhK4NXsGhyBY-tU0haANKkvpOkWAg0n4bs_vBan/s72-c/100605-0001.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-1589919419447835427</id><published>2010-05-31T23:53:00.023+09:00</published><updated>2010-06-02T17:02:45.149+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="category"/><category scheme="http://www.blogger.com/atom/ns#" term="objective-c"/><title type='text'>Objective-C カテゴリでプロパティ</title><summary type="text">例えばこんなクラスがあるとする。

Customer.h

@interface Customer :&amp;nbsp; NSManagedObject &amp;nbsp;{}
@property (nonatomic, retain) NSString * address1;@property (nonatomic, retain) NSString * postcode;@property (nonatomic, retain) NSString * lastname;@property (nonatomic, retain) NSString * address2;@property (nonatomic, retain) NSString * firstname;@property (nonatomic, retain) NSDate * birthdate;@property (</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1589919419447835427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1589919419447835427'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/objective-c.html' title='Objective-C カテゴリでプロパティ'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-6953746966916784234</id><published>2010-05-30T23:19:00.045+09:00</published><updated>2010-06-02T15:21:48.987+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="情報"/><title type='text'>今週のCocoa情報(5/30) - 今週気になった Cocoaプログラミング情報の紹介</title><summary type="text">How to get macos Log-in User Name in objective-c - Stack Overflow

Ｑ）ログイン中のユーザ名を取得するには？
Ａ）NSUserName() を使う

Foundation Functions Reference

他にも

NSFullUserName
NSHomeDirectory
NSHomeDirectoryForUser

なんてものがある。


Break on EXC_BAD_ACCESS in XCode? - Stack Overflow

EXC_BAD_ACCESS 解決に NSZombieEnabled を使う件。
CocoaDev: NSZombieEnabled



Cocoa Singleton conventions - Stack Overflow

Ｑ）シングルトンパターンを使う場合の</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/6953746966916784234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/6953746966916784234'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/cocoa530-cocoa.html' title='今週のCocoa情報(5/30) - 今週気になった Cocoaプログラミング情報の紹介'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-4945510817606204943</id><published>2010-05-29T23:17:00.000+09:00</published><updated>2010-06-02T15:21:29.319+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - テーブルの件数を取得する（SQL確認）</title><summary type="text">以前、別のブログで CoreDataでテーブルの件数を取得する記事を書いた。

Cocoa Touch の日々: CoreData - テーブルの件数を取得する

発行される SQLを調べてなかったので確認してみた。

SELECT COUNT(*) FROM ZSTYLETAG t0※iPhoneSDK3.1.3にて


無駄なSQLは出ていないようだ（当然か）。</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/4945510817606204943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/4945510817606204943'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/coredata-sql.html' title='CoreData - テーブルの件数を取得する（SQL確認）'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-1214975877194512523</id><published>2010-05-28T07:09:00.001+09:00</published><updated>2010-05-28T07:09:00.692+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - SQLite の LIMIT</title><summary type="text">-[NSFetchRequest setFetchBatchSize:] で指定したサイズ値がフェッチ時に発行される SQLの LIMIT値となる。

例えば
[fetchRequest setFetchBatchSize:20];とするとSQLはこうなる。
SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZMODIFIEDDATE, t0.ZFEE, t0.ZMEMO, t0.ZCREATEDDATE, t0.ZOPERATEDDATE, t0.ZCUSTOMER FROM ZKARTE t0 WHERE  t0.Z_PK IN  (?,?,?)  ORDER BY t0.ZOPERATEDDATE DESC LIMIT 20
３件ヒットするケースで、サイズを1とすると
[fetchRequest setFetchBatchSize:1];
こうなる。
sql: </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1214975877194512523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/1214975877194512523'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/coredata-sqlite-limit.html' title='CoreData - SQLite の LIMIT'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-7440250742199546804</id><published>2010-05-27T12:55:00.013+09:00</published><updated>2010-05-27T13:17:53.902+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - 検索見本（NSManagedObjectを条件に検索）</title><summary type="text">NSPredicate を使う。
例えば、Customer（マスタ）＜−−−＞＞ Karte（ディティール）というモデルがあり、特定の Customer に紐づく Karteの一覧を取得する場合。


// Edit PredicadeNSPredicate* predicate =&amp;nbsp;&amp;nbsp;[NSPredicate predicateWithFormat:@&quot;customer == %@&quot;, customer];[request setPredicate:predicate];

オブジェクトが条件の場合でも上記のように等号条件として書ける。

SQLite のログはこう。
SELECT 0, t0.Z_PK FROM ZKARTE t0 WHERE  t0.ZCUSTOMER = ? ORDER BY t0.ZOPERATEDDATE DESC

SELECT 0, </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/7440250742199546804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/7440250742199546804'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/coredata-nsmanagedobject.html' title='CoreData - 検索見本（NSManagedObjectを条件に検索）'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-2973106799014649732</id><published>2010-05-26T06:57:00.127+09:00</published><updated>2010-05-27T12:18:57.851+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - マイグレーション</title><summary type="text">モデルの修正
CoreDataのマイグレーションを試してみた。通常モデルに修正を加えると、直前に作成したSQLiteDBは使えず実行時エラーが出る。この場合、SQLiteDBを一旦削除する必要がある。当然データの引き継ぎはできない。

エラーログ：







[16769:a0f] Error Domain=NSCocoaErrorDomain Code=134100 UserInfo=0x116760 &quot;The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store.&quot;[16769:a0f] This NSPersistentStoreCoordinator has </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/2973106799014649732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/2973106799014649732'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/coredata_26.html' title='CoreData - マイグレーション'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAqw4baASmeDWO_uClz2LNgbNG9AFjY3gFDwRcH_KAPGtgCwDX2gauMM7R9ZkdDWqjJip6K9dtFu0RIWKV139NpkiJcOkBXg-Wk5yuFAlsOwa8MIrD-MJlQLrVqMkAnzq9EnVKY2fBPzY7/s72-c/100525-0006.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-119406613985748167</id><published>2010-05-25T06:13:00.001+09:00</published><updated>2010-05-25T06:13:00.176+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - Xcodeでモデルクラスを自動生成する</title><summary type="text">Xcodeのモデルクラス自動生成機能を使った開発および運用方法など。

自動生成方法
モデルエディタでモデルを選択した後、メニューから「ファイル ＞ 新規ファイル」を選ぶと管理クラスオブジェクトが選べるようになるのでこれを選択する。

生成されるクラス下図のモデルのクラスを自動生成すると、関連（リレーションシップ）用のメソッドが追加される。



BlogEntry.h
@class Tag;@class BlogComment;
@interface BlogEntry :&amp;nbsp; NSManagedObject &amp;nbsp;{}
@property (retain) NSDate * created;@property (retain) NSString * title;@property (retain) NSString * content;@property (retain</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/119406613985748167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/119406613985748167'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/coredata-xcode.html' title='CoreData - Xcodeでモデルクラスを自動生成する'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisGTSIHid_HPEMQVozaQQ7exFpLhlVMdRNZAZVh0HKHEfwpFV2QqrwXp_gf931jPsa-d3C0d9nqyaLtRAxoASzhrWsZvp8XatJQeENB8fLQsTO_kUeKOAwHX3ZaPVEipFtfhBI-1lV2ZBD/s72-c/100521-0022.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-9118910775256712994</id><published>2010-05-24T12:29:00.007+09:00</published><updated>2010-05-24T12:39:06.291+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - モデル見本</title><summary type="text">（前回）Cocoaの日々: CoreData - リレーションシップ(6) 削除ルール「アクションなし」「無効にする」の比較

前回までの検証結果を図にまとめてみた。





※SQLite のER図は Mac OS X 10.5での検証結果（10.6は未確認）

- - - -
間違い、改善点などあればぜひ教えていただきたい（コメントへどうぞ）。</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/9118910775256712994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/9118910775256712994'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/coredata.html' title='CoreData - モデル見本'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_AQtptb7Qcia4OT1x3GbReQO8M5qY_6OyczdirQ-haaVB7NyP-1JxN14XoEbCrjhArzpVij5RcCDhzL-_DpKiTZ30G2F-G9K02osD3rINGq9C20qP5JqYstY644Ko3MlANUzrNh_D7Cud/s72-c/100524-0002.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-193073054792061310</id><published>2010-05-23T23:18:00.007+09:00</published><updated>2010-05-24T12:20:36.974+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="情報"/><title type='text'>今週のCocoa情報(5/23) - 今週気になった Cocoaプログラミング情報の紹介</title><summary type="text">GCDを試してみる - As Sloth As Possible
面白い。参考になった。


Best way to do interprocess communication on Mac OS X - Stack Overflow
MacOSXでの プロセス間通信の方法について。
・Control files
・Sockets
・Distributed objects
など。


get the position of icons on the Desktop (cocoa OSX) - Stack Overflow
デスクトップアイコンの位置を取得するには？
⇒ FSGetCatalogInfoBulk を使う（らしい）。

File Manager Reference - FSGetCatalogInfoBulk 

Legacy: Finder Interface </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/193073054792061310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/193073054792061310'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/cocoa523-cocoa.html' title='今週のCocoa情報(5/23) - 今週気になった Cocoaプログラミング情報の紹介'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-2873488403084814688</id><published>2010-05-22T08:39:00.067+09:00</published><updated>2010-05-22T08:39:00.256+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - リレーションシップ(6) 削除ルール「アクションなし」「無効にする」の比較</title><summary type="text">（前回）Cocoaの日々: CoreData - リレーションシップ(5) マスター・ディティールとカスケード削除

タグを削除して削除ルールの違いを見てみる。

（参考）モデル



削除コード：

-(void)deleteFirstTag{ NSManagedObjectContext* moc = [self managedObjectContext];  // (1) fetch from BlogEntry NSLog(@&quot;----- executeFetchRequest ------------------------------------------&quot;); NSFetchRequest* request = [[NSFetchRequest alloc] init]; [request setEntity:[NSEntityDescription </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/2873488403084814688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/2873488403084814688'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/coredata-6.html' title='CoreData - リレーションシップ(6) 削除ルール「アクションなし」「無効にする」の比較'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAs0UbuKifvleJ17yakGe2IVU-pIamBX9JKDRYGpogckAJdEXMJakDEPbXezx2w0ijXbBNJDD3CctRF5QeUj-RSS1COqO7XbaMYMx3SI_tQwWcIMNrENtIXgvctursR7Vj79Ov9OF9ZOfG/s72-c/100521-0005.gif" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-6759028727953235373</id><published>2010-05-21T12:37:00.112+09:00</published><updated>2010-05-21T15:36:07.241+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - リレーションシップ(5) マスター・ディティールとカスケード削除</title><summary type="text">（前回）Cocoaの日々: CoreData - リレーションシップ(4) タグを使った検索

前回までは多対多のリレーションシップでを扱ったが、今回は一般的なマスター・ディティール（１対多）を扱ってみる（順番でいけばこっちの方を先に試すべきだったかもしれない）。

まず BlogComment というモデルを追加し、BlogEntry と関連づける。
設定。

BlogComment.entry は、必須（非オプション）、削除ルール＝カスケード、としておく。

コメント登録コード：

-(void)addComment{ NSManagedObjectContext* moc = [self managedObjectContext];  // (1) fetch from BlogEntry NSFetchRequest* request = [[NSFetchRequest </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/6759028727953235373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/6759028727953235373'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/coredata-5.html' title='CoreData - リレーションシップ(5) マスター・ディティールとカスケード削除'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRPDvmah2JFCGAvWb8VjdQHvKpQtuTsBFHw7Lx4wHPlQCfcFu1D4tUvVNm1n1nFTt6S6byUAH_BifNyj5QnsHlKOGlBKaRO63_t1R48pTSVJyBxYntjFpFr3iZTnp-gvqkiSe7C3u_4rNr/s72-c/100521-0005.gif" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-9077495448448724410.post-7481483451628902481</id><published>2010-05-20T23:30:00.054+09:00</published><updated>2010-05-21T13:37:06.587+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coredata"/><title type='text'>CoreData - リレーションシップ(4) タグを使った検索</title><summary type="text">（前回）Cocoaの日々: CoreData - リレーションシップ(3) 多対多のモデリング

今回はタグを使った検索を行ってみる。といってもエントリの検索と全く同じ。

- (void)fetchDataByTag{ NSManagedObjectContext* moc = [self managedObjectContext];  NSFetchRequest* request = [[NSFetchRequest alloc] init]; [request setEntity:[NSEntityDescription entityForName:@&quot;Tag&quot;   inManagedObjectContext:managedObjectContext]];  NSError* error = nil; NSLog(@&quot;----- executeFetchRequest ----</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/7481483451628902481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9077495448448724410/posts/default/7481483451628902481'/><link rel='alternate' type='text/html' href='http://xcatsan.blogspot.com/2010/05/coredata-4.html' title='CoreData - リレーションシップ(4) タグを使った検索'/><author><name>xcatsan</name><uri>http://www.blogger.com/profile/07611922019852427552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdeTc1eTYlJS-Qg43v6YG1Nwi2SiFr7t-YtXTBr_xKn2pteJhdKRwMdWBToCyIZp9DsdfZx39wK7966YEVGOLX1p-GDf90dyMu1OSZNjbbM9y-Lxllbjw00piUPPcmg/s220/pro.jpg'/></author></entry></feed>