嗨,我刚刚从一个Cordova项目的新结构开始,我需要安装此插件org.apache.cordova.network-information。
我正在使用cordova 3.5.0。
安装并运行cordova build后,出现此错误:
Undefined symbols for architecture i386:
"_SCNetworkReachabilityCreateWithAddress", referenced from:
+[CDVReachability reachabilityWithAddress:] in CDVReachability.o
"_SCNetworkReachabilityCreateWithName", referenced from:
+[CDVReachability reachabilityWithHostName:] in CDVReachability.o
"_SCNetworkReachabilityGetFlags", referenced from:
-[CDVReachability connectionRequired] in CDVReachability.o
-[CDVReachability currentReachabilityStatus] in CDVReachability.o
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[CDVReachability startNotifier] in CDVReachability.o
"_SCNetworkReachabilitySetCallback", referenced from:
-[CDVReachability startNotifier] in CDVReachability.o
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[CDVReachability stopNotifier] in CDVReachability.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld build/emulator/EconnectHybrid.app/EconnectHybrid normal i386
(1 failure)
Command finished with error code 65: /Users/dev/Development/ncoi-econnect-hybrid/platforms/ios/cordova/build
Error: /Users/dev/Development/ncoi-econnect-hybrid/platforms/ios/cordova/build: Command failed with exit code 65
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:755:16)
at Process.ChildProcess._handle.onexit (child_process.js:822:5)
isdc30408:ncoi-econnect-hybrid dev$
如果我尝试从XCODE构建,则会出现此错误:
Undefined symbols for architecture armv7:
"_SCNetworkReachabilityGetFlags", referenced from:
-[CDVReachability connectionRequired] in CDVReachability.o
-[CDVReachability currentReachabilityStatus] in CDVReachability.o
"_SCNetworkReachabilityCreateWithAddress", referenced from:
+[CDVReachability reachabilityWithAddress:] in CDVReachability.o
"_SCNetworkReachabilityCreateWithName", referenced from:
+[CDVReachability reachabilityWithHostName:] in CDVReachability.o
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[CDVReachability startNotifier] in CDVReachability.o
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[CDVReachability stopNotifier] in CDVReachability.o
"_SCNetworkReachabilitySetCallback", referenced from:
-[CDVReachability startNotifier] in CDVReachability.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
最佳答案
听起来SystemConfiguration.framework
应该是由org.apache.cordova.network-information插件自动添加的,但事实并非如此。
我最终根据以下注释在SystemConfiguration.framework
中手动添加了Build Phases > Link Binary With Libraries
,并为我修复了该问题:
https://issues.apache.org/jira/browse/CB-6443