2011-11-15 40 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

是的,你是对的!感谢提示,我喜欢避免链接不必要的框架。 –