【发布时间】:2015-07-17 17:31:30
【问题描述】:
像这样安装了cordova-network-plugin:
cordova plugin add cordova-network-plugin
对于一个正常工作的 Cordova 项目(之前在 iOS 上构建成功),该项目莫名其妙地无法为 iOS 构建 (cordova build ios)。
它在 Android 上运行良好,但在 iOS 上会产生以下错误消息:
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/WowSuchApp.app/WowSuchApp normal i386
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Doge/Desktop/WowSuchApp/cordova/platforms/ios/cordova/build-debug.xcconfig,-project,WowSuchApp.xcodeproj,ARCHS=i386,-target,WowSuchApp,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/Doge/Desktop/WowSuchApp/cordova/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/Doge/Desktop/WowSuchApp/cordova/platforms/ios/build/sharedpch
ERROR building one of the platforms: Error: /Users/Doge/Desktop/WowSuchApp/cordova/platforms/ios/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/Doge/Desktop/WowSuchApp/cordova/platforms/ios/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
对我来说,这个插件似乎与i386 不兼容,尽管我觉得这很难相信。因此,我尝试为armv7 编译它,使用
cordova build ios --device
错误信息与上面类似,只是暗指armv7而不是i386。
【问题讨论】: