SCNetworkReachability编译错误

我试图在这里编译Ercia Sadun的示例代码,但是这个错误出现了:

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之后,它也报告了同样的错误。 为什么要这样做,我怎样才能使它工作?

你添加了哪个SystemConfiguration.framework? 第一行明确指出

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

但是你应该在SDK开发包/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks添加SDK。

该框架应该通过在项目的右键菜单中的“Add Existing Framework …”添加。