【问题标题】:Undefined symbols for architecture i386: "_SCNetworkReachabilitySetCallback"架构 i386 的未定义符号:“_SCNetworkReachabilitySetCallback”
【发布时间】:2011-10-30 01:35:30
【问题描述】:

我在 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 在那里,错误仍然在那里...... 会是什么? 谢谢

【问题讨论】:

    标签: objective-c frameworks ios-frameworks


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      玩得开心...!

      【讨论】:

        【解决方案3】:

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

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

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

        【讨论】:

          【解决方案4】:

          很简单。

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

          前缀sc表示系统配置

          • 点击项目名称选择右侧的Summary

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

          • 点击加号然后你可以看到一个包含框架和库集合的向下钻取看看是否有任何调用 系统配置框架

          • 选择它并按确定

          • 现在buildrun问题解决了

          【讨论】:

            【解决方案5】:

            当我使用 AFNetworking 时,在收到这些错误后导入了 3 个框架

            CFNetwork.framework
            Security.framework
            SystemConfiguration.framework
            

            所有错误都会消失.. 享受吧!!!

            【讨论】:

              【解决方案6】:

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

                  CFNetwork.framework
                  Security.framework
                  SystemConfiguration.framework
              

              非常感谢!

              【讨论】:

                【解决方案7】:

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

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

                【讨论】:

                  【解决方案8】:

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

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

                  【讨论】:

                    猜你喜欢
                    • 2011-08-14
                    • 2023-03-11
                    • 1970-01-01
                    • 1970-01-01
                    • 1970-01-01
                    • 1970-01-01
                    • 2012-02-12
                    相关资源
                    最近更新 更多