【问题标题】:Phonegap Build Firebase push notification on IOS not working (but working on Android)IOS上的Phonegap Build Firebase推送通知不工作(但在Android上工作)
【发布时间】:2019-11-19 10:45:33
【问题描述】:

谁能帮我解决我的 Phonegap 混合应用程序的以下问题?我正在使用 Phonegap Build 来处理数据。

我的 ios 设备没有收到推送通知,但我的 android 设备收到了。 我在 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>    
 ..

我的有效载荷看起来像这样......

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

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

...我在应用中的推送初始化看起来像这样...

   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: {}
      }
  );

我正在使用 App Store Production 配置,并且正在通过 Testflight 测试应用程序。

非常感谢。

【问题讨论】:

  • 当我直接通过 Firebase Cloud 测试应用程序时,它会收到推送通知。它只是没有使用我自己的有效负载发送者代码(使用您在上面看到的有效负载)接收它。

标签: ios push-notification phonegap-build phonegap


【解决方案1】:

答案是确保使用了正确的 APN 和配置文件。 APN 中未包含推送通知,并且配置文件必须用于“生产”而不是开发。

我希望这对其他人有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-04
    • 1970-01-01
    • 2016-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-22
    • 2020-01-31
    相关资源
    最近更新 更多