我正在尝试在我的项目中使用可达性。我添加了 Reachability.h 和 Reachability.m 文件。但是在构建项目之后 xCode 向我显示了奇怪的错误:
Undefined symbols for architecture i386:
"_SCNetworkReachabilityCreateWithName", referenced from:
+[Reachability reachabilityWithHostname:] in Reachability.o
"_SCNetworkReachabilityCreateWithAddress", referenced from:
+[Reachability reachabilityWithAddress:] in Reachability.o
"_SCNetworkReachabilitySetCallback", referenced from:
-[Reachability startNotifier] in Reachability.o
-[Reachability stopNotifier] in Reachability.o
"_SCError", referenced from:
-[Reachability startNotifier] in Reachability.o
"_SCErrorString", referenced from:
-[Reachability startNotifier] in Reachability.o
"_SCNetworkReachabilitySetDispatchQueue", referenced from:
-[Reachability startNotifier] in Reachability.o
-[Reachability stopNotifier] in Reachability.o
"_SCNetworkReachabilityGetFlags", referenced from:
-[Reachability isReachable] in Reachability.o
-[Reachability isReachableViaWWAN] in Reachability.o
-[Reachability isReachableViaWiFi] in Reachability.o
-[Reachability connectionRequired] in Reachability.o
-[Reachability isConnectionOnDemand] in Reachability.o
-[Reachability isInterventionRequired] in Reachability.o
-[Reachability reachabilityFlags] in Reachability.o
我该如何解决这个问题?
最佳答案
可能您忘记将 SystemConfiguration.framework 添加到您的项目中。如果您不知道如何添加框架,请查看此 SO question .
关于objective-c - Apple 的 Reachability 文件中的奇怪错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11013997/