Expo push -токен не доступен в Build ios testflight (работает в Expo go)IOS

Программируем под IOS
Ответить Пред. темаСлед. тема
Anonymous
 Expo push -токен не доступен в Build ios testflight (работает в Expo go)

Сообщение Anonymous »

Я использую Expo + EAS, чтобы построить свое приложение React Native для iOS. Push -уведомления работают нормально на выставке, и я могу получить токну Expo push, используя: < /p>
import { useState, useEffect, useRef } from 'react';
import * as Notifications from 'expo-notifications';
import * as Device from 'expo-device';
import { Platform, Alert } from 'react-native';
import Constants from 'expo-constants';

function handleRegistrationError(errorMessage: string) {
throw new Error(`Push notification registration failed: ${errorMessage}`);
}

export async function registerForPushNotificationsAsync() {
if (Platform.OS === 'android') {
Notifications.setNotificationChannelAsync('default', {
name: 'default',
importance: Notifications.AndroidImportance.MAX,
vibrationPattern: [0, 250, 250, 250],
lightColor: '#FF231F7C',
});
}

if (Device.isDevice) {
const { status: existingStatus } =
await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;

if (existingStatus !== 'granted') {
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}

if (finalStatus !== 'granted') {
handleRegistrationError(
'Failed to get push token for push notification!'
);
return;
}
const projectId =
Constants?.expoConfig?.extra?.eas?.projectId ??
Constants?.easConfig?.projectId;
if (!projectId) {
handleRegistrationError(
'Project ID is not defined in the Expo configuration.'
);
}

try {
const token = (await Notifications.getExpoPushTokenAsync({
projectId,
})).data;
console.log('Push notification token:', token);
return token;

}catch (error) {
handleRegistrationError(
`Failed to get push token: ${error instanceof Error ? error.message : String(error)}`
);
}

}
}

< /code>
Однако, когда я создаю приложение для производства, используя EAS -сборку и устанавливаю его через Testflight, токен не возвращается. Вот что я подтвердил до сих пор: < /p>
✅ Ключ Push правильно настроен в учетных данных EAS < /p>
✅ Профиль обеспечения активного и действительного < /p>
✅ Использование правильного Bundleidive < /p>
✅ App Подписано и публикуется с использованием Eax < /p>

✅ ancefication antsificator добавляется с помощью inablebackgroundremotenotifications: true < /p>
{
"expo": {
"name": "test",
"slug": "test",
"version": "1.0.7",
"orientation": "portrait",
"icon": "./assets/icon.png",
"scheme": "app",
"userInterfaceStyle": "automatic",
"newArchEnabled": true,
"ios": {
"supportsTablet": false,
"bundleIdentifier": "com.test.mynewapp",
"entitlements": {
"com.apple.developer.push-notifications": true
},
"infoPlist": {
"ITSAppUsesNonExemptEncryption": false,
"UIDeviceFamily": [
1
],
"NSCameraUsageDescription": "This app does not use the camera. This is required for compliance due to included libraries."

}
},
"android": {
"icon": "./assets/icon.png",
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"edgeToEdgeEnabled": true,
"package": "com.test.mynewapp"
},
"web": {
"bundler": "metro",
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"plugins": [
"expo-router",
[
"expo-splash-screen",
{
"image": "./assets/icon.png",
"imageWidth": 200,
"resizeMode": "contain",
"backgroundColor": "#ffffff"
}
],
[
"expo-notifications",
{
"enableBackgroundRemoteNotifications": true
}
]
],
"experiments": {
"typedRoutes": true
},
"extra": {
"router": {},
"eas": {
"projectId": "8e56511a-ec55-7343-v31f-63g111019c98"
}
}
}
}



Подробнее здесь: https://stackoverflow.com/questions/796 ... rks-in-exp
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Expo push -токен не доступен в Build ios testflight (работает в Expo go)
    Anonymous » » в форуме IOS
    0 Ответы
    2 Просмотры
    Последнее сообщение Anonymous
  • Firebase Push -уведомление не получает в Testflight Build для iOS
    Anonymous » » в форуме IOS
    0 Ответы
    10 Просмотры
    Последнее сообщение Anonymous
  • Обновление сертификата Apple Push Push Push
    Anonymous » » в форуме IOS
    0 Ответы
    48 Просмотры
    Последнее сообщение Anonymous
  • Flutter — токен APNS еще не установлен. Убедитесь, что токен APNS доступен, вызвав getAPNSToken().
    Гость » » в форуме IOS
    0 Ответы
    51 Просмотры
    Последнее сообщение Гость
  • Flutter — токен APNS еще не установлен. Убедитесь, что токен APNS доступен, вызвав getAPNSToken().
    Anonymous » » в форуме IOS
    0 Ответы
    26 Просмотры
    Последнее сообщение Anonymous

Вернуться в «IOS»