I use Expo push Notifications to send Notifications to GSM using push token. My code is :
registerForPush = async () => {
if (Constants.isDevice) {
const { status: existingStatus } = await Permissions.getAsync(
Permissions.NOTIFICATIONS,
);
let finalStatus = existingStatus;
if (existingStatus !== 'granted') {
const { status } = await Permissions.askAsync(
Permissions.NOTIFICATIONS,
);
finalStatus = status;
}
if (finalStatus !== 'granted') {
alert('Failed to get push token for push notification!');
return;
}
const gsm = await Notifications.getExpoPushTokenAsync();
this._storeData('TOKEN_GSM', gsm);
} else {
alert('Must use physical device for Push Notifications');
}
};
async componentDidMount() {
this.registerForPush();
}
When i use Expo to run the App i granted manually the permissions to get the token, but now i ejected to app to run IOS project with Xcode. I got an error that i can't get push token : Failed to get push token for push notification