Cordova build IOS with CocoaPods configured - ios

I have created a Cordova project using my mac and I added IOS platform tot he project (cordova platform add ios)
On adding plugins, phonegap-plugin-push plugin expects to use CocoaPods to manage tthe plugin. After adding the plugin and adding the Platfom, I build the project using the command cordova build ios
It looks like it is trying to build the CocoaPods project created when adding the platform and it is getting failed. Below is the error. It should build my Xcode project.
Error: /Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
Can anyone help me to build my IOS project.
My Cordova version is 6.4.0; My IOS version is 10.11.6; My Xcode version is 8.1
Thanks.

Related

How to build a cordova project in xcode?

I want to build my cordova project so I can publish it in the app store.
when i load the project from ./src-cordova/platforms/ios/myapp.xcodeproj in xcode
And I want to build it I get the following error
error: Build input file cannot be found: '/Users/user/Projects/git/myapp/src-cordova/platforms/ios/CordovaLib/Cordova/Info.plist' (in target 'Cordova' from project 'CordovaLib')
I tried to change the project properties to legacy build and changed the built option Any iOS device (arm64) and any mac (silicon,intel) but still get the same error.
What to I have to do to build the app so that I can publish it.
The solution was to delete the cordova project and reinstall it cordova platform rm ios and then cordova platform add ios

Cordova ios -Your ios platform does not have Api.js in old project

When we run cordova plugin add cordova-plugin-inappbrowser
command ,I have got error "Your ios platform does not have Api.js". Because I have a old project in ios cordova.
Is the any way to add plugin manually.
You should update the cordova-ios version of your project or downgrade the Cordova CLI to use an older version that included the cordova-ios version you have in the project.
You can also try to install the plugins with --nofetch param at the end.

Swift Cordova bridge undefined error

I'm following instructions at http://moduscreate.com/writing-a-cordova-plugin-in-swift-for-ios/ to generate a Swift based Cordova plugin for IOS.
When I get as far as adding the IOS platform via command 'cordova platform add ios' I'm expecting something like the example:
Adding ios project...
iOS project created with cordova-ios#4.0.1
Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist#1" via npm
Installing "cordova-plugin-whitelist" for ios
Installing "cordova-plugin-add-swift-support" for ios
Update IOS build setting SWIFT_OBJC_BRIDGING_HEADER to:
/Users/simon/projects/modus/swiftplugin/modusechopluginswift/testapp2/platforms/ios/TestApp/Bridging-Header.h
Update IOS build setting EMBEDDED_CONTENT_CONTAINS_SWIFT to: YES
What I actually get is:
Adding ios project...
Creating Cordova project for the iOS platform:
Path: platforms/ios
Package: com.moduscreate.testapp
Name: TestApp
iOS project created with cordova-ios#4.2.1
Installing "cordova-plugin-add-swift-support" for ios
Error: undefined is not a function
The platforms folder has a generated IOS subfolder with content.
I assume the problem is with the cordova-plugin-add-swift-support plugin.
I'm running xCode 8.0 on macOS Sierra 10.12.
Does anybody have any ideas?
I'm the author of the tutorial you were following. I recently updated it to address changes for Swift 3, so if you want to try this with the latest Cordova, XCode 8.2 and Swift 3 syntax, I've produced a new tutorial here. Following this may solve your issues.

Cordova 5 not handling new ios application target in XCode

I just upgraded to Cordova 5. Any XCode project that has more than one application target causes an error on build.
cordova build ios
could not find -Info.plist file, or config.xml file.
Steps to recreate:
Create a new Cordova project
Add iOS as a platform
In the XCode project, duplicate the application target to create a new target
Run "cordova build ios"
Currently using XCode 6.3.2 and Cordova 5.1.1
There is a pull request with a fix: https://github.com/apache/cordova-lib/pull/219
Until Cordova team fix it, look here:
Second answer

PhoneGap CLI "cordova build ios" failed

i have created a new hello world project using the following command,
cordova create hello com.example.hello HelloWorld
the project is created successfully, then i add the ios platform by
cordova platform add ios
and to verify i have it added correctly, i type
cordova platform list
the iOS platform is shown in the list. so at this point, according to the PhoneGap tutorial, i can use the command
cordova build ios
to build the iOS version of the project. however, i encounter the following error:
Generating config.xml from defaults for platform "ios"
Preparing ios project
Compiling app on platform "ios" via command "/Users/Aldour/PhoneGap/hello/platforms/ios/cordova/build"
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while building the ios project.
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cordova/src/compile.js:65:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
the results that i have googled are mostly concerning the android version, talking about the invalid environment path setting. i dont know if it is related since i can create and build a PhoneGap project targeting the android platform without problem.
here is my $PATH:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin/node:/usr/local/bin/npm:/Developer/SDKs/android-sdk-macosx/platform-tools:/Developer/SDKs/android-sdk-macosx/tools
EDIT:
problem solved by re-installing xcode from app store
I had the same problem in Android platform, and it was solved with the commands:
cordova platform rm android
cordova platform add android
cordova build android
in Node.Js console. try it in ios.
If you get an error with 'cordova platform add android', you may need to manually remove any android folders in your project folder hierarchy.
This resolved my issue:
cordova platform remove ios
cordova platform add ios
cordova build ios
If you run the build with --verbose, you will probably see some permission issues. By default, XCode creates a folder of the build in ~/Developer, if you haven't changed it. There probably is a permissions issue when creating that folder. Just execute the following command: sudo cordova bulid ios
That should fix your issue.

Resources