35

我在 openglES 项目中使用 xcode4,我从教程中添加了用于应用内购买的代码: http ://www.raywenderlich.com/2797/introduction-to-in-app-purchases

我添加了 SystemConfiguration.framework 但发生此错误:

Ld /Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Products/Debug-iphonesimulator/blatest.app/blatest normal i386
    cd /Users/Eros/Desktop/blatestDB
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Products/Debug-iphonesimulator -F/Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Products/Debug-iphonesimulator -F/Users/Eros/Desktop/blatestDB -filelist /Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Intermediates/blatest.build/Debug-iphonesimulator/SLQTSOR.build/Objects-normal/i386/blatest.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework AVFoundation -framework AudioToolbox -framework CoreAudio -framework CoreGraphics -framework OpenAL -lz -framework MediaPlayer -framework AVFoundation -framework GameKit -framework StoreKit -o /Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Products/Debug-iphonesimulator/blatest.app/blatest

Undefined symbols for architecture i386:
  "_SCNetworkReachabilitySetCallback", referenced from:
      -[Reachability startNotifier] in Reachability.o
  "_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
      -[Reachability startNotifier] in Reachability.o
  "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
      -[Reachability stopNotifier] in Reachability.o
  "_SCNetworkReachabilityGetFlags", referenced from:
      -[Reachability currentReachabilityStatus] in Reachability.o
      -[Reachability connectionRequired] in Reachability.o
  "_SCNetworkReachabilityCreateWithName", referenced from:
      +[Reachability reachabilityWithHostName:] in Reachability.o
  "_SCNetworkReachabilityCreateWithAddress", referenced from:
      +[Reachability reachabilityWithAddress:] in Reachability.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

如果我删除框架引用,错误是一样的。再次添加没有任何反应......在 -Xlinker 2 -framework Foundation -framework UIKit [...] 我应该看到“-framework SystemConfiguration”吗?为什么不存在?有人有想法吗?

从项目中提取框架->构建阶段->将二进制文件与库链接,使其成为我遇到此错误的第一个框架:

Ld /Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Products/Debug-iphonesimulator/blatest.app/blatest normal i386
    cd /Users/Eros/Desktop/blatestDB
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Products/Debug-iphonesimulator -F/Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Products/Debug-iphonesimulator -F/Users/Eros/Desktop/blatestDB -filelist /Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Intermediates/blatest.build/Debug-iphonesimulator/SLQTSOR.build/Objects-normal/i386/blatest.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework SystemConfiguration -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework AVFoundation -framework AudioToolbox -framework CoreAudio -framework CoreGraphics -framework OpenAL -lz -framework MediaPlayer -framework AVFoundation -framework GameKit -framework StoreKit -o /Users/Eros/Library/Developer/Xcode/DerivedData/blatest-acmdklrqungznggpjewgxuxqsvwo/Build/Products/Debug-iphonesimulator/blatest.app/blatest

ld: warning: ignoring file /Users/Eros/Desktop/blatestDB/SystemConfiguration.framework/SystemConfiguration, missing required architecture i386 in file
Undefined symbols for architecture i386:
  "_SCNetworkReachabilitySetCallback", referenced from:
      -[Reachability startNotifier] in Reachability.o
  "_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
      -[Reachability startNotifier] in Reachability.o
  "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
      -[Reachability stopNotifier] in Reachability.o
  "_SCNetworkReachabilityGetFlags", referenced from:
      -[Reachability currentReachabilityStatus] in Reachability.o
      -[Reachability connectionRequired] in Reachability.o
  "_SCNetworkReachabilityCreateWithName", referenced from:
      +[Reachability reachabilityWithHostName:] in Reachability.o
  "_SCNetworkReachabilityCreateWithAddress", referenced from:
      +[Reachability reachabilityWithAddress:] in Reachability.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

SystemConfiguration 在那里,错误仍然在那里......它可能是什么?谢谢

4

8 回答 8

51

找到了!我已将 SystemConfiguration.framework 复制到我的项目文件夹中(当我从 xcode 添加时选中该框)。在我的项目中删除该文件夹现在编译得很好

于 2011-08-19T12:47:25.587 回答
38

SystemConfiguration.framework从构建阶段添加后,我的项目编译良好......

玩得开心...!

于 2013-02-07T12:46:39.353 回答
10

我也有同样的问题。我直接通过拖放添加了一些框架。

为了解决这个问题,我删除了所有这些并通过菜单Target>Build Phases添加它们,然后再次通过Link Binary With Libraries添加所有需要的框架。

在此之后,您的代码应该可以再次正常工作。

于 2012-03-31T08:47:01.917 回答
8

这很简单。

scnetworkreachability回调被标记为未定义的符号,这意味着缺少某些库或框架文件

前缀sc表示系统配置

  • 单击项目名称选择右侧的摘要

  • 单击链接二进制文件和框架

  • 单击加号,然后您可以看到包含框架和库集合的下钻,看看是否有任何称为 systemConfigurationframework

  • 选择它并按确定

  • 现在编译运行问题就解决

于 2013-04-09T04:46:55.277 回答
5

如上所述,导入以下3个框架后,就可以了!

    CFNetwork.framework
    Security.framework
    SystemConfiguration.framework

非常感谢!

于 2013-12-06T05:01:27.493 回答
5

When i was using AFNetworking, after getting these errors imported 3 frameworks

CFNetwork.framework
Security.framework
SystemConfiguration.framework

All errors will gone.. enjoy !!!

于 2013-11-19T09:28:07.100 回答
0

从 repo 更新后我遇到了同样的问题。

对我有用的解决方案是从项目中删除所有类的引用并再次添加它们。问题是很有可能会搞乱 repo 同步。

于 2012-03-29T20:15:00.073 回答
0

我想指出我也遇到了与此类似的问题。

我将一些文件复制到 xcode 并意外选择了“ProjectTests”而不是项目。只需删除文件并将它们重新添加到您的项目中,确保选择主项目(而不是单元测试)

于 2012-02-28T17:41:35.830 回答