简体   繁体   English

Phonegap Build Firebase IOS 上的推送通知不工作(但在 Android 上工作)

[英]Phonegap Build Firebase push notification on IOS not working (but working on Android)

Can anybody help me solve the following issue with my Phonegap hybrid app?谁能帮我解决我的 Phonegap 混合应用程序的以下问题? I'm using Phonegap Build to process the data.我正在使用 Phonegap Build 来处理数据。

My ios devices aren't receiving push notifications but my android devices are.我的 ios 设备没有收到推送通知,但我的 android 设备可以。 I'm using the following data in config.xml:我在 config.xml 中使用以下数据:

 ...
 <preference name="phonegap-version" value="cli-9.0.0" />  
 <platform name="android">
     <resource-file src="google-services.json" target="app/google-services.json" />
 </platform>
 <platform name="ios">
     <resource-file src="GoogleService-Info.plist" />    
 </platform>
 <plugin name="phonegap-plugin-push" spec="2.1.3">
     <variable name="SENDER_ID" value="xxxxxxxxxxxxx" />
 </plugin>    
 ..

My payload looks like this...我的有效载荷看起来像这样......

  $data = [
         "title"             =>$titlenotification,  
         "message"           => $message,
         "content_available" => "1",
  ];

  $fields =  [
        'registration_ids'   => $registrationtokens,          
        'data'               => $data,                         
        "priority"           => "high",
        "content_available"  => true,
  ];

...and my push initialisation in the app looks like this... ...我在应用程序中的推送初始化看起来像这样...

   var push = PushNotification.init({
        android: {
          senderID: senderId,  
          iconColor: "#d4edda",
          alert: true,
          badge: true,
          icon: 'notification_icon',
          sound: true,
          vibrate: true,
        },
        browser: {},
        ios: {
          senderID: senderId,  
          sound: true,
          vibration: true,
          badge: true
        },
        windows: {}
      }
  );

I'm using an App Store Production provision and I'm testing the app through Testflight.我正在使用 App Store Production 配置,并且正在通过 Testflight 测试该应用程序。

Many thanks.非常感谢。

The answer was to ensure that the correct APN and profile was in use.答案是确保使用正确的 APN 和配置文件。 Push notification had not been included on the APN, and the profile must be for "prodduction" not development. APN 中未包含推送通知,并且配置文件必须用于“生产”而不是开发。

I hope that helps someone else.我希望这对其他人有所帮助。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM