SCNetworkReachability编译错误

时间:2010-03-09 10:48:06

标签: iphone

我尝试编译Ercia Sadun的示例代码here,但出现了这个错误:

warning: in /Users/interdev/iphone source code/Web Browser/Classes/SystemConfiguration.framework/SystemConfiguration, missing required architecture i386 in file
    Undefined symbols:
      "_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
          +[UIDevice(Reachability) scheduleReachabilityWatcher:] in UIDevice-Reachability.o
      "_SCNetworkReachabilityCreateWithAddress", referenced from:
          +[UIDevice(Reachability) hostAvailable:] in UIDevice-Reachability.o
          +[UIDevice(Reachability) pingReachabilityInternal] in UIDevice-Reachability.o
      "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
          +[UIDevice(Reachability) unscheduleReachabilityWatcher] in UIDevice-Reachability.o
      "_SCNetworkReachabilitySetCallback", referenced from:
          +[UIDevice(Reachability) scheduleReachabilityWatcher:] in UIDevice-Reachability.o
          +[UIDevice(Reachability) scheduleReachabilityWatcher:] in UIDevice-Reachability.o
          +[UIDevice(Reachability) unscheduleReachabilityWatcher] in UIDevice-Reachability.o
      "_SCNetworkReachabilityGetFlags", referenced from:
          +[UIDevice(Reachability) hostAvailable:] in UIDevice-Reachability.o
          +[UIDevice(Reachability) pingReachabilityInternal] in UIDevice-Reachability.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
        "_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
            +[UIDevice(Reachability) scheduleReachabilityWatcher:] in UIDevice-Reachability.o
        "_SCNetworkReachabilityCreateWithAddress", referenced from:
            +[UIDevice(Reachability) hostAvailable:] in UIDevice-Reachability.o
            +[UIDevice(Reachability) pingReachabilityInternal] in UIDevice-Reachability.o
        "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
            +[UIDevice(Reachability) unscheduleReachabilityWatcher] in UIDevice-Reachability.o
        "_SCNetworkReachabilitySetCallback", referenced from:
            +[UIDevice(Reachability) scheduleReachabilityWatcher:] in UIDevice-Reachability.o
            +[UIDevice(Reachability) scheduleReachabilityWatcher:] in UIDevice-Reachability.o
            +[UIDevice(Reachability) unscheduleReachabilityWatcher] in UIDevice-Reachability.o
        "_SCNetworkReachabilityGetFlags", referenced from:
            +[UIDevice(Reachability) hostAvailable:] in UIDevice-Reachability.o
            +[UIDevice(Reachability) pingReachabilityInternal] in UIDevice-Reachability.o
      ld: symbol(s) not found
      collect2: ld returned 1 exit status
    Build failed (5 errors)

...即使我添加了systemConfiguration.framework,它也报告了同样的错误。为什么会这样做,我怎样才能使它发挥作用?

1 个答案:

答案 0 :(得分:97)

您添加了哪个SystemConfiguration.framework?第一行明确说明

  

警告:在/Users/interdev/iphone source code/Web Browser/Classes/SystemConfiguration.framework/SystemConfiguration中,缺少文件中所需的架构i386

但您应该在/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks

中添加SDK

应该通过项目右键菜单中的“添加现有框架...”添加框架。