简体   繁体   English

用于 ios 的cordova-plugin-firebase

[英]cordova-plugin-firebase for ios

I have some issue with cordova-plugin-firebase": "^2.0.5", i received the notification using android, but in ios i have some problem, the console logs show this error :我在使用cordova-plugin-firebase": "^2.0.5" 时遇到了一些问题,我使用android 收到了通知,但在ios 中我遇到了一些问题,控制台日志显示此错误:

1 - 1 -

[Firebase/Messaging][I-FCM002023] The object <AppDelegate: 0x2838a9280> does not respond to -messaging:didReceiveRegistrationToken:. Please implement -messaging:didReceiveRegistrationToken: to be provided with an FCM token.

2 - 2 -

[Firebase/InstanceID][I-IID003014] Error while reading embedded mobileprovision Error Domain=NSCocoaErrorDomain Code=260 "The file “embedded.mobileprovision” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/var/containers/Bundle/Application/697DE4E1-C6A4-461F-A6B5-2AF26447E1E1/SmartGeoLoc.app/embedded.mobileprovision, NSUnderlyingError=0x2836d1a40 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

And after receiving the Token , this error occured :收到令牌后,出现了这个错误:

3 - 3 -

5.7.0 - [Firebase/Messaging][I-FCM004001] Failed to subscribe to topic Error Domain=com.google.fcm Code=0 "(null)"

If I test sending un example of notification , the return response is :如果我测试发送通知示例,返回响应是:

{"multicast_id":6967427466880320868,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"NotRegistered"}]}

NB : I have created the certificat from apple developer console , and also a keys ,And importe the file AuthKeyxxxxx.pm8 to the firebase console.注意:我已经从苹果开发者控制台创建了证书,还有一个密钥,并将文件 AuthKeyxxxxx.pm8 导入到 firebase 控制台。

My Provider :我的供应商:

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Platform } from 'ionic-angular';
import { Firebase } from '@ionic-native/firebase';
import { Storage } from '@ionic/storage';
import { environment } from '../../environments/environment';


@Injectable()
export class FcmProvider {
  token;

  constructor(public http: HttpClient,private storage: Storage, private platform: Platform, public firebase: Firebase) {
    console.log('Bonjour FcmProvider Provider');
  }

  initializeFirebase(){
    if(!this.platform.is("core")) {
      this.getToken();
      this.firebase.subscribe("all");
    }
  }


  getToken() {
    if (this.platform.is('ios')) {
      this.firebase.grantPermission()
      .then(() => {
        this.firebase.getToken().then(token => {
          console.log("My Token ", toen);
        });        
      })
      .catch((error) => {
        this.firebase.logError(error);
      });
    }else{
      this.firebase.getToken().then(token => {
        console.log("My Token ", toen);
      });
    }

  }

  onNotifications() {
    return this.firebase.onNotificationOpen().subscribe(
      (msg) => {
        if(msg.tap){
            console.log(msg);
        }else{
          if (this.platform.is('ios')) {
            console.log(msg.aps.alert);
          }else {
            this.presentToast(msg.body);
          }
        }        
    });
  }
}

More information => ionic info更多信息 => 离子信息

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

    @ionic/cli-utils  : 1.19.3
    ionic (Ionic CLI) : 3.20.1

global packages:

    cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) 

local packages:

    @ionic/app-scripts : 3.2.3
    Cordova Platforms  : android 7.1.4 ios 4.5.5
    Ionic Framework    : ionic-angular 3.9.2

System:

    ios-deploy : 1.9.4 
    Node       : v10.13.0
    npm        : 6.9.0 
    OS         : macOS High Sierra
    Xcode      : Xcode 10.1 Build version 10B61 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

Package Used :使用的包裹:

"cordova-android-firebase-gradle-release": "^2.1.0",
"cordova-android-play-services-gradle-release": "^2.1.0",
"cordova-android-support-gradle-release": "^1.4.4",
"@ionic-native/firebase": "^4.20.0",
"cordova-plugin-firebase": "^2.0.5",
"firebase": "^4.8.0",

最后,我找到了一个解决方案,我从 File -> Project Settings -> Build System 更改了项目系统构建并选择: Legacy Build System ,默认为 new legacy。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Cordova-plugin-firebase:无法在iOS 12.2上运行,但可以在android和iOS 10.3.3上正常运行 - Cordova-plugin-firebase: Cannot run on iOS 12.2 but works without any problems on android and iOS 10.3.3 iOS的Cordova-Plugin-Firebase:设备收到推送通知,但未显示在设备上 - Cordova-Plugin-Firebase, iOS: device receives push notification but does not appear on device 如何删除cordova-plugin-firebase中的UIWebView代码 - How to remove UIWebView code in cordova-plugin-firebase 适用于iOS 10的cordova firebase插件 - cordova firebase plugin for ios 10 + 适用于iOS的cordova-firebase-plugin配置 - cordova-firebase-plugin configuration for iOS 使用Phonegap插件在IOS Cordova上收到Firebase FCM通知 - Firebase FCM notification to received on IOS cordova using the Phonegap Plugin 带有phonegap-plugin-push和Firebase的Cordova iOS通知。 没工作 - Cordova iOS notifications with phonegap-plugin-push and Firebase. No work Cordova Firebase插件-在iOS的通知栏中不显示通知 - Cordova Firebase Plugin - Not showing notifications in notification bar on iOS cordova,Firebase,FCM插件 - 未在iOS上的通知栏中显示通知 - cordova, Firebase, FCM Plugin - Not showing notifications in notification bar on iOS Firebase FCM 与 google plus cordova 插件冲突 - IOS - Firebase FCM with google plus cordova plugin conflict - IOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM