Cordova网络插件不是在iOS上构建的 [英] Cordova Network Plugin does not build on iOS

查看:128
本文介绍了Cordova网络插件不是在iOS上构建的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装了 cordova-network-plugin

cordova plugin add cordova-network-plugin

到工作中的Cordova项目在iOS上),该项目莫名其妙地无法为iOS( cordova build ios )构建。

to a working Cordova project (build was successful on iOS previously), the project inexplicably failed to build for iOS (cordova build ios).

它适用于Android,但会为iOS生成以下错误消息:

It builds fine for Android, but produces the following error message for 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 ,虽然我觉得这很难相信。因此,我试图使用

To me, it seems the plugin is simply not compatible with i386, though I find this hard to believe. I therefore tried to compile it for armv7, using

cordova build ios --device

错误消息类似于上述,除了引用

The error message is similar to that above, except alluding to armv7 instead of i386.

推荐答案

问题似乎是,Cordova不总是添加所需的框架到您的iOS项目,当你添加一个插件。

The issue appears to be that Cordova doesn't always add the required frameworks to your iOS project when you add a plugin.

大多数项目需要 AudioToolbox.framework (调试)。

Most projects will need the AudioToolbox.framework (debugging).

cordova-plugin-network-information 将需要 SystemConfiguration.framework

cordova-plugin-contacts 将需要 AddressBook.framework AddressBookUI.framework CoreGraphics.framework

添加框架:


  1. 在Xcode中选择您的项目

  2. 选择您的目标

  3. 选择构建阶段标签

  4. 打开< > expander

  5. 点击 +

  6. 选择所需的框架并将其添加到项目中

  1. Select your project in Xcode
  2. Select your target
  3. Select the Build Phases tab
  4. Open the Link Binaries With Libraries expander
  5. Click the +
  6. Select your desired framework and add it to the project

这篇关于Cordova网络插件不是在iOS上构建的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆