Cannot build IOS for bms push Cordova project - ios

I'm not able to build IOS for my cordova project. I have added bms-push plugin and I'm getting error cannot find cannot find module bms core

I was just able to successfully add the bms-push plugin and compile a project. Without more detailed error logs and recreation steps, it will be difficult to diagnose your error.
Make sure you have followed the steps in the README here:
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-push/#configuration
Installing the bms-push library (cordova plugin add bms-push) should automatically pull down bms-core as a dependency.

Related

Ionic app loads using Ionic serve but not with Xcode

I'm currently stuck on a problem related to my Ionic project.
I have an Ionic project on GitHub which i've been working on in the past few weeks, i have a few Cordova plugins as part of the project.
When downloading the project from GitHub, i can run the app using Ionic Serve without a problem. However, when trying to setup the project for xCode to run on local device(s), i run into a multitude of errors
Some include:
When running ionic 'cordova platform add ios' the following error appears
Error: Could not install from "ios" as it does not contain a package.json file.
When trying to run 'ionic cordova run ios -l --external'
Error: Error: terminating with uncaught exception of type NSException
I have not yet tried to transfer my code into a new Ionic project, as i wish to see if my problem can be solved without that hassle.
View project code here: https://github.com/designsheikh/bitsandbobs.git
I figured it out. You have the exact same issue I've had with the android platform.
As I pointed it out in the comments, it is indeed caused by a "corrupted" project architecture.
How it happened
Initially, I had an issue with the cordova generated resources, somehow not being copied into the android platform directory. I tried plenty of things with the cordova-res CLI, including using the --copy and the --ios-project flags to force the copy to happen in the directory of my choice.
I couldn't manage to fix my issue, and then decided to rollback all my changes and start over on a clean project to try something else. Since then, I was not able to add the android platform anymore. Every single time, the following error was being thrown :
Error: Could not install from "android" as it does not contain a package.json file.
Explanation
With all my testing, I noticed that when using cordova to add the platform or copy the resources over, somehow, it had created the android platform in the wrong directory, at the root of my project instead of in the platforms folder. And that's where the issue comes from.
I can't explain it, but you will encounter this error every single time if you try to add a platform with cordova while having a folder with this platform name at the root of your project. I have no idea why this would prevent a platform from being added to the project, maybe this folder is used as a temp folder by the CLI.
Solution
The fix is to simply remove any ios or android directory at the root of your project.
The error will go away and you will be able to add the platform again.
#CodingJunkie
Regarding the Github repository you provided in your post, you will likely run into another error while trying to add the ios platform if you use cordova#>=9.0.0.
Using "requireCordovaModule" to load non-cordova module "xcode" is not supported.
Instead, add this module to your dependencies and use regular "require" to load it.
Check this issue#1033 for a workaround. However, it's not recommended to directly edit the plugin source code, you might want to look for another cordova Firebase plugin.
I also noticed you kinda mixed up cordova and capacitor in your project.
Make sure to use one or the other to avoid potential errors.
Hope this helped !
#Reqven
Thank you for your support! - i was sure that i had done this step while trying to fix the issue. It is such an absurd problem, it seems that there is a new project architecture as you mentioned which needs to be followed. I followed your steps with also one minor additional step as im working on the iIOS platform:
Delete iOS folder
cordova platform add ios
cordova prepare ios
ionic build
If step 2 throws an error causing the version not to be found or integrated into the project run - include '#latest' this also solved my problem

Failed to install phonegap-plugin-push in ios cordova 8.0

I have created a new package in Cordova 8.0 and installed all the plugins.
when adding an android platform its fine.
But when add iOS firebase-analytics and phonegap-push plugins are not installing
Either this or that only installing
If I remove phonegap-push and add pod install its added.
Or else remove firebase then add phone-gap pod is installing.
when using both plugins second one was not installing its says
Even I tried pod update, pod install, platform remove & add, plugin remove & add all the scenarios.
Does anybody have an idea please update.
Thanks
That's exactly the issue that my pull request solves. Firebase implementations are not consistent across plugins and tend to introduce these easily avoidable errors.
The pull request has not been accepted yet, so proceed like this:
Uninstall the push plugin
Download it anywhere and edit the same files I have edited
Install the plugin from the path of your local copy.
Also, if you prefer you can remove the iOS platform instead, then edit the plugin files from your project's folder, then re-add the platform. This will install the newly edited plugin with your changes included, and hopefully, without the errors.
I have fixed the incompatibility between Firebase Auth and Push Plugin by editing the files exactly as show, then removing and re-adding the iOS platform. If this solves your problem kindly send a positive feedback on the Issue tracker so the PR is accepted sooner. It's been already added to the 3.0.0 milestones.

Cordova Build Error After Removing And Add The Same Plugin

I am getting build error while I am removing the plugin through Cordova CLI and again add the same plugin. Anybody can help me why I am getting error?
Thanks in Advance :)
Hi myself found the issue. While I am adding plugin to cordova iOS project, required frameworks also getting added to the XCode Project (Frameworks mentioned in plugin.xml). And while I am removing the plugin, the framework already added still remains in the XCode project navigator window. When again I am adding the plugin, cordova not adding the framework to this project hence getting the build error.
Solution
Run Cordova remove plugin through CLI
Manually remove the unused framework reference from the xcode project.
Add the plugin through Cordova CLI
I think this is either a Cordova or XCode bug. This error is inconsistent and its is happening sometimes. I got this error while developing & testing custom Cordova plugin.

custom plugin installation procedure in worklight6.0

Few days back i started working on ibm worklight platformVersion="6.1.0.01.20140427-1450".
But i am facing some problem regarding custom plugin. For adding native functionality to hybrid application with apache cordova plugin in IOS I found the following link
http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/06_03_iOS_-_Adding_native_functionality_to_hybrid_application_with_Apache_Cordova_plugin.pdf
I tried this but everytime on compilation i got "linker command failed with exit code 1 (use -v to see invocation)".
So my question is that after cordova 2.9 ,it stopped adding classes and files manually. So we do the same by installing the command line. But i tried the same thing in worklight based project then it gives error that it is not a cordova based project.
So i think that we can't install the plugin into worklight project with the help of command line thats why its giving the linker error.
Please try to solve my problem by proving me the solution.
Thanks in Advance
First, the error you've mentioned as-is is meaningless, you should add the full error.
Regardless,
Worklight currently does not support Cordova 3's Plugman, so you cannot easily "install" plug-ins.
As a way to show how this can be done, you can follow the guidelines provided for this question: Using katzer local notification in IBM Worklight
The solution provided in the above question shows a "step-by-step" of how to add existing Cordova 3 plug-ins to a Worklight application, for Android.
It is the same for iOS with one exception. in iOS you must reference the plug-in's .m and .h files in Xcode's Classes folder (right-click and select "Add files...")

cordova console log can not be installed

I am trying to install the cordova console.log plugin.
when i am trying to install it using the command line using:
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
I am running it from the path of the root application path
the structure of the folder is:
projName
|-- --project
|-- projName
|-- cordova
|-- CordovaLib
|-- projName.xcodeproj
|-- plugin
And the error i receive in the command line is
[Error: Current working directory is not a Cordova-based project.]
i should mention that i build the cordova project manually using imports of the frameworks because in the xcode new project window there was not Cordova/Phonegap new project option.
I am using xCode 5.0.1 and cordova 3.1.0
The error you get is self-explanatory, it is because you have not created a cordova project as it must be created. Keep reading to solve the problem.
Cordova basic project preparation steps
Based on my comment and your answer, you should follow the cordova workflow for creating projects using the CLI (command line interface), it is strongly recommended to avoid unnecessary problems, and the steps are not hard to follow.
Please follow the steps described here (official doc), read it fully, it will save you more time later if you read it:
http://cordova.apache.org/docs/en/3.2.0/guide_cli_index.md.html#The%20Command-Line%20Interface
In brief the steps are:
Install node.js
Install cordova using npm
Create a cordova project / app using the CLI
Add the desired platform to the project (android, ios, etc, as needed)
Work on your project
Add cordova plugins as necessary (for example if you need notifications add the notificacion plugin)
Build the project
Test of device or emulator (in your case iPhone, iPad simulator)
iOS Platform Guide
Also check the iOS Platform Guide completely, it is very helpful, explain additional instructions to prepare and work with XCode.
http://cordova.apache.org/docs/en/3.2.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide
Plugins
For each plugin in the API reference you will find instructions to install them using the CLI, as well as to "uninstall" them.
Only install the plugins you will need
Just for reference, the code to install notifications-dialogs plugin using the terminal (run the command inside your project folder):
$ cordova plugin rm org.apache.cordova.dialogs
On the other hand, the easier way to solve the problem is create the new project following the noted steps and later just add your existing code or files to the proper folders, as well as add the required plugins, not that difficult.

Resources