0

I'm developing the push notification feature with FCM on my app, both for Android and iOS.

After I successuflly managed the push notifications on Android devices, I was trying to do the same on a iOS one.

So, I started creted the template, like I made for Android.

But, creating the template, I got an error:

Build for ios is started

Uploading iOS keys...

Completed

Uploading an application template...

Completed

Building status: pending (13 attempts)

Building status: error ("plugman install --platform ios --project /tmp/gimlet/2719563/project --plugin phonegap-plugin-push@1.9.0": Fetching plugin "phonegap-plugin-push@1.9.0" via npm

Installing "phonegap-plugin-push" at "1.9.0" for ios

Failed to install 'phonegap-plugin-push':undefined undefined )

Removing iOS keys...

Completed

Removing the application template...

Completed

Error: Building status: error ("plugman install --platform ios --project /tmp/gimlet/2719563/project --plugin phonegap-plugin-push@1.9.0": Fetching plugin "phonegap-plugin-push@1.9.0" via npm

Installing "phonegap-plugin-push" at "1.9.0" for ios

Failed to install 'phonegap-plugin-push':undefined undefined )

This is my config.xml file:

<widget id="com.devexpress.apptemplate" version="1.0" versionCode="1">
  <name>ApplicationTemplate</name>
  <description>Template</description>
  <preference name="phonegap-version" value="cli-6.4.0" />
  <preference name="permissions" value="none" />
  <preference name="prerendered-icon" value="true" />
  <preference name="android-windowSoftInputMode" value="adjustPan" />
  <preference name="SplashScreen" value="splash" />
  <preference name="SplashScreenDelay" value="60000" />
  <preference name="AutoHideSplashScreen" value="false" />
  <preference name="SplashShowOnlyFirstTime" value="false" />
  <preference name="FadeSplashScreen" value="false" />
  <preference name="ShowSplashScreenSpinner" value="false" />
  <preference name="DisallowOverscroll" value="true" />
  <preference name="StatusBarOverlaysWebView" value="false" />
  <preference name="StatusBarBackgroundColor" value="#000000" />
  <preference name="android-minSdkVersion" value="15" />
  <preference name="android-targetSdkVersion" value="22" />
  <plugin name="cordova-plugin-geolocation" />
  <plugin name="cordova-plugin-splashscreen" onload="true" />
  <plugin name="cordova-plugin-whitelist" />
  <plugin name="cordova-plugin-ios-longpress-fix" />
  <plugin name="cordova-plugin-statusbar" onload="true" />

  <plugin name="phonegap-plugin-push" spec="1.9.0"/>

  <access origin="*" />
</widget>

The config.xml file is in the project APP.mobile (not in APP.shared). I don't understand why I can build the native template for Android (and it works like a charm) and in iOS not.

UPDATE: Summarized all the steps here: https://programmingistheway.wordpress.com/2017/07/19/devextremephonegap-how-to-manage-push-notifications-with-fcm/

Piero Alberto
  • 3,823
  • 6
  • 56
  • 108
  • please check your ios version using cordova platform. may be your ios version is not supporting the plugin require ios version. – Hiten Jul 24 '17 at 06:11
  • Solved adding the "senderID" parameter in the config.xml. I noticed it is useless here for Android, but it is mandatory for iOS. – Piero Alberto Jul 24 '17 at 10:21
  • 1
    yes, you have to write senderId in ios build too. Otherwise they will generate the error. – Hiten Jul 24 '17 at 12:16

1 Answers1

0

To use FCM you should use v2.x.x version of the plugin

Latest published version is v2.0.0-rc5, try with that, or even install from github with cordova plugin add https://github.com/phonegap/phonegap-plugin-push/

In your config.xml you have to add the google-services json and plist files like this

<platform name="android">
    <resource-file src="google-services.json" target="google-services.json" />
</platform>
<platform name="ios">
    <resource-file src="GoogleService-Info.plist" />
</platform>

In your other question you seem to be using github url, not sure why you went back to 1.9.0

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176
  • I went back to 1.9.0 because, with the latest version, it didn't create the template, giving me an error. The DevExpress me suggested me to use the 1.9.0 and then I was able to create the template. – Piero Alberto Jul 25 '17 at 08:28
  • If you want to use FCM on iOS you have to use v2.x.x, in Android google made FCM and GCM somehow compatible so it also works with 1.9.0, but that doesn't happen on iOS. You'll have to set the cli to 7.0.1 – jcesarmobile Jul 25 '17 at 08:31
  • Really? I have still to try it on iOS, are you sure about it? Can you give me a link? – Piero Alberto Jul 25 '17 at 08:41
  • I help maintaining the plugin and did the GCM to FCM migration for iOS – jcesarmobile Jul 25 '17 at 08:50
  • Wow! Cool, but I wasn't able to create the template with the 2.x version. Why? Maybe because my cli version wasn't 7.0.1? – Piero Alberto Jul 25 '17 at 09:15
  • Probably, to make resource-file tags work you need 7.0.1 – jcesarmobile Jul 25 '17 at 09:25
  • I tried to set "" but both build.phonegap.com and the build template tool within DevExtreme don't work and give me a message "PhoneGap cli-7.0.1 not supported" – Piero Alberto Jul 26 '17 at 07:21
  • Phonegap Build is still testing 7.0.1, I've seen people able to use it and others not, I don't think it will take long until you can use it, but it's not available for now – jcesarmobile Jul 26 '17 at 07:42
  • I tried to create the template without using the version 1.9.0, but it isn't included in the template. I tried both on my pc with phonegap feature and also online on the adobe site... so, how can I do? You say I have to use the 2.x version, but I can't insert it in the template (neither android or ios) – Piero Alberto Jul 26 '17 at 13:57
  • One last question, please. I solved the problem of my last comment adding the plugin with cordova cli tool. Now, in the config file I have ""... what is "^1.10.5"? Which version is? – Piero Alberto Jul 27 '17 at 06:10
  • 1
    ~ and ^ are semver characters, ~ means install last patch version (1.10.x), ^ means install last minor version (1.x.x), more on https://stackoverflow.com/questions/44547114/meaning-of-beore-plaform-version-in-cordova/44556214#44556214 – jcesarmobile Jul 27 '17 at 07:12
  • So, is "~1.10.5" correct for my case? You suggested me the version 2.x.x, but this is 1.10.5... – Piero Alberto Jul 27 '17 at 07:19
  • I don't think FCM will work on iOS with 1.10.5, you will need to wait until Phonegap Build supports CLI 7 or compile locally if you have a mac. – jcesarmobile Jul 27 '17 at 07:50
  • Yes, I have a mac but I never compile on it. I use it only for send the ipa file to itunes. What have I to do to compile locally in a mac? – Piero Alberto Jul 27 '17 at 07:57
  • You have to install Xcode and Cordova CLI 7. For more information read the cordova guide https://cordova.apache.org/docs/en/latest/guide/cli/index.html – jcesarmobile Jul 27 '17 at 08:10
  • I installed cordova 7.0.1 on my mac and repeat all the steps, but the added push plugin version is again 1.10.5... – Piero Alberto Jul 27 '17 at 12:25
  • as v2.x.x is in RC now, not sure if you have to do something special to install it. You can install latest version using github url `cordova plugin add https://github.com/phonegap/phonegap-plugin-push`. BTW, you also need to install CocoaPods – jcesarmobile Jul 27 '17 at 12:49
  • Hi jcesarmobile, I'm trying now to built the plugin with cordova 7.0.1, but now I get this error: "he following build commands failed: CopyPlistFile [....] (1 failure) Error code 65 for command: xcodebuild [...]". Here the link: https://build.phonegap.com/apps/2726929/logs/ios/build/ As you can see, I'm trying the online build tool, but it doesn't work. Do you know why? Can we keep in touch with email/telegram? – Piero Alberto Aug 02 '17 at 09:02
  • I have also this in the log "The file “GoogleService-Info.plist” couldn’t be opened because there is no such file" – Piero Alberto Aug 02 '17 at 09:24
  • Sorry, I'm on holiday at the moment without computer. I can take a look after the 15th. On pgb it might not work or work on a different way. Try putting the .plist and .json files inside www and add the www to the path in the resource-file tag – jcesarmobile Aug 02 '17 at 12:54
  • 1
    I'm still on holiday, but just saw this blog post about Phonegap build supporting 7.0.1 and the push plugin 2.0.0 https://blog.phonegap.com/phonegap-7-0-1-now-on-build-and-it-includes-some-important-changes-89087fe465f5, maybe it can help you – jcesarmobile Aug 09 '17 at 20:48
  • Thanks jcesar, I saw it but they speak about a plugin push issue to be solved... so, bad news.. hope for a quick fix – Piero Alberto Aug 10 '17 at 06:10
  • 1
    There is a note However iOS 4.4.0 (cli-7.0.1) on PGB has now been patched for CB-13112, so push 2.0.0 with cli-7.0.1 should now be working. – jcesarmobile Aug 10 '17 at 11:02
  • Hi, I have still problem. Now, in Android I get the PushNotification as undefined. Why? Can we keep in touch in some way? Anyway, look here for my last issue: https://github.com/phonegap/phonegap-plugin-push/issues/1903 – Piero Alberto Aug 14 '17 at 13:28
  • Thanks jcesar, really! :) Summarized all the steps here: https://programmingistheway.wordpress.com/2017/07/19/devextremephonegap-how-to-manage-push-notifications-with-fcm/ – Piero Alberto Sep 01 '17 at 14:55