&tag(Objective-C/ARC); *目次 [#f34d63c5] #contents *参考情報 [#t637a312] *概要 [#hf8a1004] -[[Objective-C ARCによるメモリ管理 | YOHEI's BLOG:http://cx5software.com/blog/2011/12/31/objective-c-memory_management_by_arc/]] *よくある質問 [#p83e50cb] **ソース単位でnon-ARC/ARCを切り替えたい [#rbd74703] -[[EZ-NET: ファイル毎に ARC の有効・無効を設定する - Automatic Reference Counting:http://program.station.ez-net.jp/special/objective-c/llvm/arc/enable-file.asp]]…TargetのBuild Phases→Compile Sourcesでファイルをダブルクリックして設定できる。 --有効にした場合: -fobjc-arc --無効化したい場合: -fno-objc-arc **non-ARC/ARC混在継承 [#f0efe894] -[[EZ-NET: クラスの継承で従来コードと ARC コードが混在する場合 - Automatic Reference Counting:http://program.station.ez-net.jp/special/objective-c/llvm/arc/hybrid-class.asp]]によると細かい問題はありそうだけど一応できる雰囲気。 -[[objective c - ARC, non-ARC, and inheritance - Stack Overflow:http://stackoverflow.com/questions/11018137/arc-non-arc-and-inheritance]]にもそういうことがかかれてある。sourcecode preprocessorだからできるよてきな。 **プロジェクトがARC対応プロジェクトかどうか確認したい [#i0723ab6] -TargetのBuild Settings [Objective-C Automatic Reference Counting]を確認する。 **ARCでweakSelfはブロックの中だけで使えばいいのか。 [#zafbc6d8] -[[objective c - How is self passed to methods (or how to prevent strong reference cycles) - Stack Overflow:http://stackoverflow.com/questions/13801632/how-is-self-passed-to-methods-or-how-to-prevent-strong-reference-cycles]] -_weakが影響するのは変数のみ。ブロック内部で「[self foo]」を呼び出したとき、fooメソッド内部でselfを使うのは問題ない。