Took a while to track this one down... Even though this works fine on my Android devices, on iOS my push registration code was not getting called. No amount of alerts() would change that.
Finally, I put in this little piece of code to see if the bloody plugin was even installed.
var plugins = cordova.require("cordova/plugin_list").metadata; alert("plugins: " +JSON.stringify(plugins) );
Nope. No phonegap-plugin-push to be seen. So, on to the build logs...
Oh... lookie here...
Installing "phonegap-plugin-push" for ios Running command: .../builds/build.2016-07-16.14-05-53.Z3mnpE.tmp/cordova_project/platforms/ios/cordova/version Command finished with error code 0: .../builds/build.2016-07-16.14-05-53.Z3mnpE.tmp/cordova_project/platforms/ios/cordova/version Plugin doesn't support this project's cordova-ios version. cordova-ios: 4.0.1, failed version requirement: >=4.1.0 Skipping 'phonegap-plugin-push' for ios
For my money I'd bet I did something wrong so lets go check the version requirements for the plugin...
Oh lookie... Cordorva version supported 3.6.3. - OK, so this is on the push plugin guys...
BUT WAIT, there's more...
Can I change the cordorva-ios version?
Gee... it looks like I'm building with the latest version of the compiler but that doesn't get me to the minimum version needed for the phonegap-plugin-push to install.
Any suggestions on this? It's Saturday afternoon and I'm stuck!
Please see the description regarding how to make a newer version of the plugin work with the Intel XDK build system in the plugin management panel for that plugin. In particular, follow the links to the FAQ in the description. Technically, the fix only applies to usage of later versions of that plugin with Android, so you don't have to make the fix if you are not building for Android. Making the fix will not interfere with iOS builds. In essence, you need to use a later version of that plugin.
Paul, did you even bother reading my post? Seriously? Did you?
It WORKS ON ANDROID JUST FINE!!!!
it's not being included in the ios build because the cordova-ios version is too old for this plugin and going to the latest plugin will not fix this problem as it also requires the later cordova-ios build.
As for the faq you reference, unless you can see one that's different than the faq in instructions in the add-plugin console, or any of the 50 articles on getting this to work, then you need to be more specific. The FAQ in the plugin console was very specific about bypassing the gradle scripts and that did work but it says nothing about fixing this problem.
Like I said, read the post... this is a cordovoa-ios version issue!
While I appreciate your help, I am really tired of chasing my tail on this and your suggestions are just another trip down another rabbit hole.
And to add just a bit more fuel to this fire...
I edited intelxdk.config.additional.xml and added this line:
<engine name="ios" spec="^4.1.0" />
This is allowed in config.xml for the cli compiler but, apparently is ignored by XDK.
Regardless, before AND after the above addition, Intel XDK v.3400 reports the build this way:
So, even though XDK reports that the plugin was added, which is contrary to the log file, the plugin was NOT added!
Phil -- I took a lot of time to consider the issue you are experiencing, as I do with the majority of the form posts I encounter. This time is in addition to the non-forum work I am responsible for (none of us are dedicated 100% to the forum). Your post contained no detailed information regarding the specific version of the plugin you were using, so I could only assume that you were doing as many others before you have done: using the version provided by the plugin manager without reading the text and following the links provided by the plugin manager. Sorry if I was not able to read between the lines, but I was trying to help you the best I could with the limited time and information afforded -- saying it works fine on Android does not imply that you followed the instructions to eliminate the gradle script, nor does it tell me which version of the plugin you are using, it tells me that you have a version of the plugin that works fine on Android, not that you are using a version later than 1.4.3, which the plugin manager is serving up. Unfortunately, I do not have the ability to know all there is to know about what you have done, nor do I have the ability to know all combinations of problems that can arise with the thousands of third-party plugins that are available to use with Cordova, plugins that are neither developed, maintained nor controlled by myself or Intel.
When I check the plugin.xml files for later versions of that plugin I do see there is a Cordova engine requirement that states cordova-ios >=4.10. Our cordova-ios version, in our CLI 5.4.1 build system is 4.0.1 (see https://software.intel.com/en-us/xdk/faqs/cordova#cordova-version). This is not something you can change. The version of cordova-ios we offer with our next release should satisfy the requirement of that plugin (I do not know precisely the cordova-ios framework version that will be released with our build system, but it will be late enough to work). In the meantime, you might try using version 1.6.4 of that plugin, since it specifies a compatible version of the cordova-ios framework.
Regarding the fact that the plugin is "installed" but "not really" -- this appears to be an issue with detecting what I would call a "soft error" on the part of the Cordova CLI system. If the CLI system goes to completion, without any fatal errors, our build system will indicate that the build was a success, since CLI is the element that decides if a build is successful or not. I suspect the Cordova project allows for this sort of a "soft error" because it's possible to include plugins in your project that either have no support or are not relevant on some platforms (many such plugins exist). So they must be assuming that you'll know what these are. I recommend that you file an issue with the Cordova project explaining that this particular condition results in a false assumption that everything works, and that the CLI build system should emit a fatal build error. I'll recommend to our build engineers that we attempt to capture this condition.
Likewise, the summary log simply indicates that the plugin was added to the build project. Again Cordova CLI does not care if you add a plugin to a project that does not have support for a specific platform, for the same reasons cited above. So the message simply means the plugin has been "added" to the project to be built. It says nothing about the actual build process, that's what you find in the detailed build logs. Again, there might be something we can do to capture more info for build debugging, but we are dependent on what the Cordova CLI system decides is "okay" and what it decides is an "error."
Paul, I appreciate your full response.
I took the time to document this, which included screen shots, and the 2nd screen shot shows that I'm using 1.7.2. Perhaps I could have been more complete in my textual information but I thought I was complete in my post. Had this been a gradle issue, the post would have been different... hence the "it works on Android" comment. Frankly, just as support personnel "assume" that people are doing what 1000 others have done, those of us who have not and have taken the time to thoughtfully seek out help get pissed when our requests are blown off with responses that ignore our efforts and do nothing to move our problems forward. Our time matters too!
If you add the push plugin from the plugin management section and ignore the gradle warnings, it will install 1.4.3 by default but the build will not include 1.4.3 or, if it does, it does not work. Hence, 1.4.3 is a dead issue.
While I can attempt to backload to the 1.6.4 version of the plugin, I can also change the minimum required cordova-ios version for the current 1.7.2 plugin, however both come with issues:
1.6.4: Can't install multiple apps using the 1.6.4 plugin. Want to bet this will be a production issue?
1.7.2: changing the minimum build to 4.0.1 has a bug that freezes iPhones and requires an upgrade to a later version of the plugin.
Either way, the app developer is entering into a situation were we can't win.
When is the next build system due? Weeks? Months? Push notifications are a requirement for many apps. This needs addressing.
The new build system (and associated release of a new XDK) should be available within a month's time, probably sooner, but I am not in a position to make any promises. If you absolutely need it now, you can always install a local copy of Cordova CLI on your system and build locally. The code in the project is 100% Cordova compatible, your project file is a Cordova CLI project without the Cordova config.xml file and without the platform add bits. You can the bulk of what you need to build a config.xml from the various config.xml files we create, they are about 95% compatible. Of course, you will need a Mac to do the iOS build with Cordova CLI.
I am having a similar issue on v3491. My 3rd party plugins are not being included on IOS builds, but work fine on Android.
This happens whether I use Test (wifi), Debug (usb), or Build (ipa).
I am using the plugins: (tested via debugger)
- https://github.com/Shikoruma/BluetoothSerial (does not work, bluetoothSerial is undefined)
- https://github.com/don/cordova-plugin-ble-central (does not work, ble is undefined)
- de.appplant.cordova.plugin.local-notification (from 3rd party section in plugin explorer - does not work, cordova.plugins.notification is undefined)
- ionic-plugin-keyboard (from 3rd party section in plugin explorer - does not work, cordova.plugins.Keyboard is undefined)
- cordova-plugin-statusbar (from core plugins section on plugin explorer - works)
IOS Build Settings:
- Cordova CLI version: 5.4.1
- Cordova CLI version: 6.2.0
- IOS Target: 8.0
- IOS Target: 9.0
Android Build Settings:
- Cordova CLI version: 6.2.0
- Crosswalk 17
- iPad Air 2 v9.3.3 (doesn't work)
- iPhone 6+ v9.3.3 (doesn't work)
- Nexus 6p v6.0.1 (works)
- what happens if you target iOS 8?
- what happens if you build with CLI 5.4.1?
As a hard test regarding the inclusion of those plugins in your built app, do the following:
- create an app from the "hello, cordova" sample
- add your three plugins to that sample
- build the sample and deploy it to your iOS devices
- start the app on your iOS devices
- scroll through the "text area" box at the bottom of the app to find a list of plugins that are included in the app (see image below)
If the plugins show up in that list, it means they were included in the build. If you are not seeing them in your code, there may be something else that needs to be done to get access to them. For example, I've seen some plugins where the APIs reside in a different namespace on iOS compared to Android.
Thank you Paul,
Unfortunately, I did try CLI 5.4.1 and Build target 8.0 before and have updated my original post to reflect. Did not help.
I tried the "Hello Cordova" sample you mentioned and loaded the 4 non-working plugins into it, none of them showed up:
0.503 app.init.events(): entry
0.511 app.init.events(): UAParserJS results object: [object Object]
0.512 acc.initAccel(): entry
0.513 acc.initAccel(): try succeeded.
0.513 acc.initAccel(): exit
0.513 acc.initCompass(): entry
0.514 acc.initCompass(): try succeeded.
0.514 acc.initCompass(): exit
0.514 geo.initGeoLocate(): entry
0.515 geo.initGeoLocate(): navigator try succeeded.
0.515 geo.initGeoLocate(): exit
0.516 app.updateDeviceInfo(): entry
0.516 app.updateDeviceInfo(): exit
0.517 app.updateViewportInfo(): entry
0.525 app.updateViewportInfo(): exit
0.526 app.init.debug(): entry
0.527 device.cordova: 4.1.1
0.527 device.model: iPad5,4
0.527 device.platform: iOS
0.527 device.version: 9.3.3
0.527 window.Cordova typeof: object
0.528 cordova.version: 4.1.1
0.528 cordova.platformId: ios
0.529 app.init.debug(): exit
0.529 app.init.hideSplashScreen(): entry
0.530 app.init.hideSplashScreen(): exit
0.530 app.init.events(): exit
I know that Ionic-keyboard is a very popular plugin, so this is a MAJOR problem.
Also, I noticed that the provisioning profiles need to be in a new folder than the previous version, although I received no error on old projects that have "upgraded". There should have been a warning message or the files automatically moved to the proper locations on upgrade.
EDIT: I noticed there is now a BLE sample app in the XDK new project menu. Doesn't work either. Can't find variable ble.
Nick -- your list of plugins the you posted look like they were taken from App Preview, not from a built app that was installed on the device. The plugins in App Preview are fixed, third-party plugins cannot be debugged using App Preview. If you were using the Debug tab to do this, it will also not work there. The Debug tab only supports third-party plugins for Android devices; when using an iOS device with the Debug tab you will only see the plugins that are part of App Preview, because you are simply debugging a "re-signed" version of App Preview with the Debug tab and an iOS device.
You must build your app and install it on an iOS device to work with third-party plugins. Please build the hello cordova app and install it on your iOS device and then look at the list of plugins in the text area in the app, they should be present.
Please see the gray paragraphs at the beginning of this doc page > https://software.intel.com/en-us/xdk/docs/using-the-debug-tab <
Wow, Thank you. That works now.
I have a binary that I created on the 1st but that one didn't work, must have been a different issue. But all is good now.
I think there should be a warning message, like when it asks the user to start app preview on their device. It could be right below that.