gpt4 book ai didi

cocoa - 使用 ARC 编译时 ImageKit 错误和警告

转载 作者:行者123 更新时间:2023-12-03 16:18:01 25 4
gpt4 key购买 nike

我正在尝试将我的项目转换为 ARC,但我在项目中使用 ImageKit。 ARC 重构工具和我自己的手动重构都会在 ImageKit 头文件中产生 ARC 错误和警告,这些头文件已包含在我自己的源文件中。它们看起来像这样:

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 不兼容?

最佳答案

结果 Xcode 4.2 崩溃了,因为我直接导入 ,并且在我的代码中只链接了 ImageKit 框架。这对于非 ARC 代码来说很好,但 ARC 不喜欢这样。

切换到导入 (进一步包括ImageKit) 并链接整个Quartz框架解决了这个问题。 [更新:看起来您不必链接整个 Quartz 框架。将导入更改为 并继续直接链接 ImageKit。]

这很奇怪。

关于cocoa - 使用 ARC 编译时 ImageKit 错误和警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8143631/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com