我使用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。弹出权限弹出。 –