已安装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
。
答案 0 :(得分:0)
问题似乎是,当您添加插件时,Cordova并不总是将所需的框架添加到您的iOS项目中。
大多数项目都需要AudioToolbox.framework
(调试)。
cordova-plugin-network-information
将需要SystemConfiguration.framework
。
cordova-plugin-contacts
将需要AddressBook.framework
,AddressBookUI.framework
和CoreGraphics.framework
。
添加框架: