fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
624 stars 989 forks source link

iOS 11 #387

Open ironbone opened 6 years ago

ironbone commented 6 years ago

Does somebody is able to use this plugin on ios 11. I get the notification only when I start my app. When the app is working it obtains no notifications

raghuyt commented 6 years ago

Hi , am also facing same problem ,but am not installed plugin coco pod on ios ,installed only "cordova-plugin-fcm" and done FCM setting its working all IOS Expect 11. i am able to get token id also, sending notification through API getting successful responses also ,but notification not coming IOS 11 but 10 its coming Any suggestions? @ironbone Am also facing same problem its working all IOS except 11.

ironbone commented 6 years ago

As I can see in
https://github.com/fechanique/cordova-plugin-fcm/blob/master/src/ios/AppDelegate%2BFCMPlugin.m there is hardcodet the version 10 on iOS several times. For example: `#if defined(IPHONE_10_0) && IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 @import UserNotifications;

endif

and #if defined(IPHONE_10_0) && IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 @interface AppDelegate () <UNUserNotificationCenterDelegate, FIRMessagingDelegate> @end

endif`

So maybe it will work when we extend to iOS 11?

raghuyt commented 6 years ago

@ironbone i tried that but that is not working

Reactor13 commented 6 years ago

I tried it on iOS 11.0.2 today. So far no problems found.

raghuyt commented 6 years ago

@Reactor13 have done any changes for plugin ?

Reactor13 commented 6 years ago

@raghuyt no, i did not.

Just only last version of plugin, ionic part, ionic core. I tested it first with blank ionic template.

raghuyt commented 6 years ago

@Reactor13 can you share me your code please

Reactor13 commented 6 years ago

@raghuyt This is not my code. I just create blank ionic application and follow all instruction for install this plugin.

raghuyt commented 6 years ago

@Reactor13 thank you now its working in all IOS versions ,till now IOS version 11.0.2 its working all devices what i made changes is this updated our cordova to new version and platform IOS to new version

ironbone commented 6 years ago

I was able to get notifications on 11.0.2 but after upgrading to 11.0.3 the same program does not work.

raghuyt commented 6 years ago

@ironbone Just i checked its working fine . are you updated cordova to new version and platform IOS to new version ?

ironbone commented 6 years ago

You right. Sorry. After reinstaling cordowa and creating new ios platform it works. So every time when a new version of iOS arives we have to rebuid ALL. Thank you for the answer.

raghuyt commented 6 years ago

@ironbone Welcome.

yuyinitos commented 6 years ago

I've got everything on the latest version but notifications are not received on my iOS 11.1 device. I do get a token though. Just no notifications. I've tried sending message through the Firebase notifications dashboard as well as your test tool. Although only the legacy key is accepted in your test tool.

This is my setup:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.16.0
ionic (Ionic CLI) : 3.16.0

global packages:

cordova (Cordova CLI) : 7.1.0 

local packages:

@ionic/app-scripts : 3.0.1
Cordova Platforms  : ios 4.5.3
Ionic Framework    : ionic-angular 3.7.1

System:

ios-deploy : 1.9.2 
ios-sim    : 6.1.2 
Node       : v8.4.0
npm        : 5.4.2 
OS         : macOS High Sierra
Xcode      : Xcode 9.1 Build version 9B55 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

My code:

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, Platform } from 'ionic-angular';
import { FCM } from '@ionic-native/fcm';

@IonicPage()
@Component({
  selector: 'page-chat',
  templateUrl: 'chat.html',
})
export class ChatPage {

  constructor(
    public navCtrl: NavController, 
    public navParams: NavParams,
    private platform: Platform,
    private fcm: FCM
  ) {
    this.setNotifications();
  }

  setNotifications() {
    this.platform.ready().then(() => {

      // Works fine
      this.fcm.getToken().then(token => console.log('Token', token));

      // Nothing received
      this.fcm.onNotification().subscribe(data => {
        console.log('On notification', JSON.stringify(data))
      })

    })
  }
}

I've downloaded the GoogleService-Info.plist file into the root of my Ionic project. The app id's correspond.

The console of Xcode:

2017-11-04 13:18:43.623237+0100 goMICE[2891:789405] Cordova view ready
2017-11-04 13:18:44.183622+0100 goMICE[2891:789405] FCMPlugin.js: is created
2017-11-04 13:18:44.184055+0100 goMICE[2891:789405] FCMPlugin Ready OK
2017-11-04 13:18:44.184277+0100 goMICE[2891:789405] Ionic Native: deviceready event fired after 4892 ms
2017-11-04 13:18:44.239821+0100 goMICE[2891:789405] THREAD WARNING: ['StatusBar'] took '54.414062' ms. Plugin should use a background thread.
2017-11-04 13:18:58.599323+0100 goMICE[2891:789405] get Token
2017-11-04 13:18:58.599795+0100 goMICE[2891:789405] view registered for notifications
2017-11-04 13:18:58.672061+0100 goMICE[2891:789405] Token dl6dqksrnXo:APA91bGprsUwuIN7vWPBP4r6qmDWqnrIbijF_wZyRdwiUvF0pEzVbYdIgsW7v9qVMF9qc1tigq1oap2SUZgTRQuqkcaAiz5b50Bw2LT9TROBKCEhNd2P6VIQPgmh7107sEqvUOaV-GRp

Any ideas?

okandeb commented 6 years ago

same problem here.