我正在尝试发送推送通知从邮递员到我的RN应用程序使用博览会。我最终得到了下面的错误:
{
"data": {
"status": "error",
"message": "The recipient \"ExponentPushToken[OrxoEFOL4iLBfbNDSTUskn]\" isn't associated with any device",
"details": {
"error": "DeviceNotRegistered"
}
}
}有人能上来帮我吗??
发布于 2017-12-20 03:18:23
由于该设备未注册,我怀疑这是一个许可问题。
如果您使用的是Android,则应在安装时启用推送通知。它们是否已启用?
如果您使用的是IOS,则需要向用户询问使用推送通知的权限。您的权限是否正确?
您可以使用expo导入权限
import { Permissions } from 'expo';使用expo权限,您可以检查是否已授予权限,以及是否尚未向用户请求权限。
const { status: existingStatus } = await Permissions.getAsync(
Permissions.NOTIFICATIONS
);
let finalStatus = existingStatus;
// only ask if permissions have not already been determined, because
// iOS won't necessarily prompt the user a second time.
if (existingStatus !== 'granted') {
// Android remote notification permissions are granted during the app
// install, so this will only ask on iOS
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
finalStatus = status;
}这是从世博会文件中摘录的。https://docs.expo.io/versions/latest/guides/push-notifications.html
请记住,您不能向标准模拟器发送推送通知。正如世博会下面所说的,
注意: iOS和安卓模拟器不能接收推送通知,要测试它们,你需要使用真实的设备。此外,当在模拟器上调用Permissions.askAsync时,无论您是否选择允许,它都会立即解析,状态为“未确定”。
https://stackoverflow.com/questions/47891721
复制相似问题