【问题标题】:React-native-firebase Bigimage not working in iosReact-native-firebase Bigimage 在 ios 中不起作用
【发布时间】:2019-07-26 14:41:41
【问题描述】:

当应用程序关闭或打开时,我无法在 ios 的通知中显示大图,但在 android 中工作

var display_notification = new firebase.notifications.Notification({
    show_in_foreground: true
  })
    .setNotificationId(notification._notificationId)
    .setTitle(notification._title)
    .setBody(notification._body)
    .setData(notification._data);
  if (Platform.OS == "android") {
    display_notification.android
      .setChannelId("fcm_default_channel")
      .android.setSmallIcon("ic_notification")
      .android.setBigPicture(notification._data.picture)
      .android.setColor("#171551");
  } else {
    display_notification.ios.addAttachment(
      "1",
      "https://files.allaboutbirds.net/wp-content/uploads/2015/06/prow-featured.jpg"
    );
  }

在 ios 中显示通知但不显示大图(丰富的通知)

【问题讨论】:

    标签: ios react-native react-native-firebase rich-notifications


    【解决方案1】:

    你可以使用IOSNotification

    iOS 特定通知设置。

    注意:其中一些设置仅适用于 iOS 9iOS 10+。 这些都被标记为适当的。

    launchImage returns nullable string;
    

    获取与通知一起使用的启动图像。

    setLaunchImage(launchImage) returns Notification;
    

    设置通知的启动图像。

    launchImage : 字符串

    例子

    notification
      .ios.setLaunchImage('notificationimage.png');
    

    Description of IOSNotification

    Description of Displaying Notifications

    【讨论】:

    • display_notification.ios.setLaunchImage("图片网址");我添加 ios 特定方法在 ios 中也不起作用
    • 你用过IOSNotification 吗?
    • 不知道如何使用IOSNotification。请详细说明
    • @RazzRathod 答案中更新了如何使用它的示例。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-03
    • 1970-01-01
    • 1970-01-01
    • 2019-11-03
    • 2017-02-13
    相关资源
    最近更新 更多