在程式設計過程中,我們會用到很多各種各樣的他人封裝的第三方代碼,但是有很多第三方都是在非ARC情況下運作的,當你使用第三方編譯時出現和下圖類似的錯誤,就說明該第三方是非ARC的,需要進行一些配置。
解決方法:
蘋果文檔Transitioning to ARC Release Notes有一種解決辦法為:
Use Compiler Flags to Enable and Disable ARC
You enable ARC using a new -fobjc-arc compiler flag. You can also choose to use ARC on a per-file basis if it’s more convenient for you to use manual reference counting for some files. For projects that employ ARC as the default approach, you can disable ARC for a specific file using a new-fno-objc-arc compiler flag for that file.
具體操作步驟入下圖:
-fno-objc-arc 是非ARC檔案在ARC環境下運作的編譯器标志
-fobjc-arc 是ARC檔案在非ARC環境下運作的編譯器标志