啓用了ARC技術

  Xcode4.2(iOS 5)以後啓用了ARC技術,雖然4.2以後版本仍然可以不開啓ARC,但是我們在建工程的時候有時爲了不想管理內存然後就啓用了ARC,但是再開發過程中需要用到第三開發類庫,而這些第三方類庫或是沒做更新而不支持ARC,然後編譯時就出現下列錯誤:

  1. 'release' is unavailable: not available in automatic reference counting mode  
  2. ARC forbids explicit message send of 'release'  
  3. 'autorelease' is unavailable: not available in automatic reference counting mode  
  4. ARC forbids explicit message send of 'autorelease'  
  5. 'retain' is unavailable: not available in automatic reference counting mode  
  6. ARC forbids explicit message send of 'retain'  

解決辦法:

1.在targets->build phases中修改compiler Flags屬性,添加:-fobjc-arc,就可以讓舊的工程支持arc;


2.在targets->build phases中修改compiler Flags屬性,添加:-fno-objc-arc,就可以讓原來支持arc的工程不使用arc,對於大部分第三方類庫來說都可以順利編譯通過




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章