Cordova network plugin not built on iOS

By cordova-network-plugin as follows:

 cordova plugin add cordova-network-plugin 

to the working Cordova project (the build was successful on the previous version of iOS ), the project inexplicably failed to build for iOS ( cordova build ios ).

It works great for Android, but generates 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) 

It seems to me that the plugin is simply not compatible with i386 , although I find it hard to believe. So I tried to compile it for armv7 using

 cordova build ios --device 

The error message is similar to the message above, except for the armv7 link instead of i386 .

0
source share
1 answer

The problem is that Cordova does not always add the necessary frameworks to your iOS project when adding a plugin.

Most projects will require AudioToolbox.framework (debugging).

cordova-plugin-network-information will require SystemConfiguration.framework .

cordova-plugin-contacts will require AddressBook.framework , AddressBookUI.framework and CoreGraphics.framework .

To add a framework:

  • Select a project in Xcode
  • Choose a target
  • Select the Build tab
  • Open Link Binaries With Libraries Extender
  • Click +
  • Select the desired structure and add it to the project
0
source

Source: https://habr.com/ru/post/1235687/


All Articles