gpt4 book ai didi

xcode - dyld : symbol not found in Snow Leopard, 认为它在不同的框架中,在 Lion 中没问题

转载 作者:行者123 更新时间:2023-12-03 17:05:12 30 4
gpt4 key购买 nike

在我的 OS X 应用程序中,我正在调用 SystemConfiguration 框架中的 SCPreferencesCreateWithAuthorization:

AuthorizationRef auth;
AuthorizationCreate(NULL, NULL, kAuthorizationFlagDefaults, &auth);
SCPreferencesRef prefRef = SCPreferencesCreateWithAuthorization(kCFAllocatorDefault,CFSTR("Get Connected"), NULL, auth);

这在 Lion 上运行良好,但是当我在 Snow Leopard 中运行该应用程序时,调用该函数时它会崩溃。奇怪的是,崩溃日志表明它认为在 IOKit 中找到了这个符号

Dyld Error Message:
Symbol not found: _SCPreferencesCreateWithAuthorization
Referenced from: /Users/localadmin/Downloads/Get Connected.app/Contents/MacOS/Get Connected
Expected in: /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit

我已将 SystemConfiguration.framework 链接到 Xcode 中的目标,并将 header 导入到我的 AppDelegate.h 中:

#import <SystemConfiguration/SystemConfiguration.h>

我做错了什么?为什么它在 Lion 下有效,但在 Snow Leopard 下不起作用。文档说它在 10.5 及更高版本中可用。

最佳答案

您是否也链接到 IOKit?尝试将 SystemConfiguration 移到链接顺序的前面。

该符号似乎也存在于 Lion 的 IOKit 框架中。我不确定 SystemConfiguration 中的符号是否只是 IOKit 中符号的别名。

无论如何,您的应用程序依赖于 IOKit 中的应用程序,这是不可取的。

您也许可以使用nm -g -m ~/"Downloads/Get Connected.app/Contents/MacOS/Get Connected" | grep SCPref来检查这一点.

关于xcode - dyld : symbol not found in Snow Leopard, 认为它在不同的框架中,在 Lion 中没问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10691426/

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