2011-11-15 63 views
3

我試圖將我的項目轉換爲ARC,但我在我的項目中使用ImageKit。 ARC重構工具和我自己的手動重構都會在ImageKit頭文件中使用ARC生成錯誤和警告,這些錯誤和警告已包含在我自己的源文件中。他們看起來像這樣:與ARC編譯時ImageKit錯誤和警告

In file included from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/ImageKit.h:9: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFController.h:12: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFOperation.m:10: 
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/IKImageBrowserView.h:176:14: error: the current deployment target does not support automated __weak references [4] 
    IBOutlet __weak NSScroller*     _horizontalScroller; 
      ^
<built-in>:115:31: note: instantiated from: 
#define __weak __attribute__((objc_ownership(weak))) 
          ^
In file included from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/ImageKit.h:9: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFController.h:12: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFOperation.m:10: 
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/IKImageBrowserView.h:177:14: error: the current deployment target does not support automated __weak references [4] 
    IBOutlet __weak id       _delegate; 
      ^
<built-in>:115:31: note: instantiated from: 
#define __weak __attribute__((objc_ownership(weak))) 
          ^
In file included from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/ImageKit.h:9: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFController.h:12: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFOperation.m:10: 
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/IKImageBrowserView.h:179:11: warning: '__strong' only applies to objective-c object or block pointer types; type here is 'void *' [3] 
    void* __strong        _reserved; 
     ^
In file included from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/ImageKit.h:10: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFController.h:12: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFOperation.m:10: 
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/IKImageBrowserCell.h:36:2: error: the current deployment target does not support automated __weak references [4] 
     __weak id     _parent; 
     ^
<built-in>:115:31: note: instantiated from: 
#define __weak __attribute__((objc_ownership(weak))) 
          ^

這就是當我設置我的項目設置爲目標10.6。當目標10.7,我只是得到警告:

In file included from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/ImageKit.h:9: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFController.h:12: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFGenerator.m:12: 
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/IKImageBrowserView.h:179:11: warning: '__strong' only applies to objective-c object or block pointer types; type here is 'void *' [3] 
    void* __strong        _reserved; 
     ^
In file included from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/ImageKit.h:10: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFController.h:12: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFGenerator.m:12: 
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/IKImageBrowserCell.h:37:8: warning: '__strong' only applies to objective-c object or block pointer types; type here is 'void *' [3] 
     void* __strong    _ibCellReserved; 
      ^
In file included from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/ImageKit.h:13: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFController.h:12: 
In file included from /Volumes/Macintosh HD/Users/simone/Development/AFGenerator.m:12: 
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/ImageKit.framework/Headers/IKPictureTaker.h:31:11: warning: '__strong' only applies to objective-c object or block pointer types; type here is 'void *' [3] 
    void *__strong _ikReserved; 
     ^
3 warnings generated. 

但我至少可以構建和定位只是ARC 10.7運行時,我的程序。

這是怎麼回事?這是正常的嗎?或者ImageKit與ARC不兼容?

+0

<雷達:// 10465720> @private __weak在IKImageBrowserView.h導致錯誤建設10.6 ARC –

+0

高德<雷達:// 13296941> __strong無效*與ARC –

回答

5

原來,Xcode 4.2是barfing,因爲我直接導入<ImageKit/ImageKit.h>,並且只有ImageKit框架鏈接在我的代碼中。非ARC代碼很好,但ARC不喜歡這樣。

切換到導入<石英/ Quartz.h >(其還包括ImageKit)和鏈接整個Quartz框架解決了這個問題。 [更新:看起來你不必鏈接整個Quartz框架。將導入更改爲<Quartz/Quartz.h>並保持直接鏈接ImageKit。]

這很奇怪。

+0

建設10.7+時的ivars導致警告我剛同樣的問題,並能夠使用'#import '工作,但仍然只鏈接ImageKit。這是有效的,因爲我只在ImageKit中使用符號,並使我的框架依賴關係足跡更小一些。感謝您發佈您的解決方案! –

+0

是的,你是對的!感謝提示,我喜歡避免鏈接不必要的框架。 –