代码之家  ›  专栏  ›  技术社区  ›  arachide

SCNetworkReachability编译错误

  •  44
  • arachide  · 技术社区  · 15 年前

    我试图编译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 回复  |  直到 11 年前
        1
  •  97
  •   bogdan    14 年前

    您添加了哪个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 .

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