3

I'm trying to convert my project to ARC, but I'm using ImageKit in my project. Both the ARC refactoring tool and my own manual refactoring produce errors and warnings with ARC in the ImageKit header files, that have been included from my own source files. They look like this:

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)))
                               ^

That's when I set my project settings to target 10.6. When targeting 10.7, I just get warnings:

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.

But I can at least build and run my program when targeting just 10.7 with ARC.

What's going on here? Is this normal? Or is ImageKit just not compatible with ARC?

1 Answers1

5

Turns out that Xcode 4.2 was barfing because I was importing <ImageKit/ImageKit.h> directly, and had only the ImageKit framework linked in my code. That was fine for non-ARC code, but ARC didn't like that.

Switching to importing <Quartz/Quartz.h> (which further includes ImageKit) and linking the whole Quartz framework solved the problem. [UPDATE: Looks like you don't have to link the whole Quartz framework. Change the import to <Quartz/Quartz.h> and keep just linking ImageKit directly.]

That's weird.

  • I just had the same issue, and was able to get it to work with `#import ` but still linking only ImageKit. This works because I only use symbols in ImageKit, and keeps my framework dependency footprint a little smaller. Thanks for posting your solution! – Quinn Taylor Nov 17 '11 at 22:46
  • Yup, you're right! Thanks for the tip, I do like avoiding linking unnecessary frameworks. – Simone Manganelli Nov 20 '11 at 22:04