我使用react-native-push-notification
,但是我遇到了問題。
With IOS simulator
or android emulator
,Everything Everything well。
但與real iphone device
,推送通知不起作用。 (在釋放模式或調試模式,兩者都沒有奏效。react-native-push-notification在ios DEVICE上不起作用
這裏是我的設置。
我檢查Capabilities
/Background Modes
/Remote notification
上XCODE
和PushNotification.configure
import React from 'react';
import PushNotification from 'react-native-push-notification';
import {
Auth
} from '../config/router';
import './ReactotronConfig';
export default class App extends React.Component {
constructor(props) {
super(props);
this.PushConfigure();
}
PushConfigure() {
PushNotification.configure({
onNotification: (notification) => {
console.log('NOTIFICATION:', JSON.stringify(notification));
},
permissions: {
alert: true,
badge: true,
sound: true,
},
popInitialNotification: true,
requestPermissions: true,
});
}
render() {
return <Auth />;
}
}
當我要推通知
const date = new Date(Date.now());
PushNotification.localNotificationSchedule({
title: '메세지가 도착 했습니다.',
message: `${data.user._id}: ${data.text}`,
date,
actions: 'Yes',
});
正如我之前所說,通知上順暢運行的所有simulator
(Xcode的IOS,Android的)。
但我不知道爲什麼通知不起作用real IOS device
。
如果你想要更多的環境或設置在我的項目,請評論。
更新 -
我沒有對Apple Developer Program
註冊。
這就是爲什麼我不能在真實IOS設備上使用通知的原因嗎?
沒有應用要求對真正的第一次運行通知權限設備? –
請檢查應用程序詢問通知許可,並檢查推送通知的證書是否完美 –
@DithithMinura yes。彈出權限彈出。 –