トークンIDでFirebaseコンソールから自分のデバイスにプッシュ通知を送信しようとしています。私は、反応ネイティブfirebaseを使用して、通知イベントに基づいてアクションを実行するアプリケーションを許可しています。私は、SDKを統合するための指示に従い、APNSの本命などを設定している:Firebaseコンソールから反応ネイティブFirebaseを使用してプッシュ通知を送信できません
http://invertase.io/react-native-firebase/#/installation-ios
マイfirebase.js
設定ファイルは次のようになります。
import RNFirebase from 'react-native-firebase';
const configurationOptions = {
debug: true
};
const firebase = RNFirebase.initializeApp(configurationOptions);
export default firebase;
私の主なリアクトコンポーネントは次のようになります。
import React, { Component } from 'react'
import {
Text,
View,
Alert,
Platform
} from 'react-native'
import firebase from './firebase'
export default class extends Component {
constructor(props) {
super(props)
this.state = {
token: ''
}
}
componentDidMount() {
firebase.messaging().getToken()
.then((token) => {
this.setState({ token })
console.log('token: ', token)
})
firebase.messaging().getInitialNotification()
.then((notification) => {
console.log('Notification which opened the app: ', notification)
})
firebase.messaging().onMessage((message) => {
console.log('messaging', message)
})
firebase.messaging().onTokenRefresh((token) => {
console.log('Refreshed FCM token: ', token)
})
}
render() {
return (
<View style={{ marginTop: 22 }}>
<Text>{this.state.token}</Text>
</View>
)
}
}
コンポーネントがマウントされ、Firebaseコンソールでそのトークンを使用して通知を送信すると、トークンが正常に取得されますが、通知は受信されません。私は実際のデバイスではなく、iPhoneを使用しています。私は、プッシュ通知を有効にした開発プロビジョニングプロファイルを使用しています。また、適切な開発APN証明書とともに、削除通知のバックグラウンド資格をファイアベースコンソールにアップロードしました。
端末で通知が届かないのはなぜですか?