小编kea*_*wei的帖子

如何将 JSON 中的字符串转换为 int Swift

self.event?["start"].string
Run Code Online (Sandbox Code Playgroud)

输出 = 可选(“1423269000000”)

我想获得 1423269000000 作为 Int

我们怎样才能做到这一点?我尝试了很多方法,例如 NSString (但它改变了值)

swift

5
推荐指数
1
解决办法
7082
查看次数

如何在前台和后台接收本机推送通知

我正在使用 React Native Push Notification https://github.com/zo0r/react-native-push-notification 目前,它会在关闭应用程序后收到推送通知。

  1. 如何将我的 pushMessage(chat) 传递到通知中?

  2. 如何让它在前台(当应用程序仍然打开时)和后台(不打开应用程序)接收推送通知 *目前它会在关闭应用程序后收到通知

我应该在哪个部分工作?

App.js
--------
PushNotification.configure({
    // (required) Called when a remote or local notification is opened or received
    onNotification: function(notification) {
        console.log( 'NOTIFICATION:', notification );

        // process the notification . * this will overwrite the My Notification 1 below
        PushNotification.localNotification({
            foreground: true,
            title: "My Notification Title",
            message: "My Notification 2", // (required)
        });

        // required on iOS only (see fetchCompletionHandler docs: https://facebook.github.io/react-native/docs/pushnotificationios.html)
        notification.finish(PushNotificationIOS.FetchResult.NoData);
    },


});


class App extends Component{ …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-ios react-native-push-notification

5
推荐指数
0
解决办法
4037
查看次数