Hi! I am new to Expo and React Native in general. We are building an app for college campuses. I am trying to implement push notification for an app. The problem I am running in to is that after going through the starter code in Expo Docs for notifications and running the app on the Expo Client for iOS I was not able to generate the token and more surprisingly I was not logging any errors. I even tried try/catch syntax for any errors but still didn’t get any errors. getExpoPushTokenAsync isn’t returning any token. This is my code:
async sendPushNotifToken() {
const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS)
console.log(existingStatus)
let finalStatus = existingStatus
if (existingStatus !== 'granted') {
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS)
finalStatus = status
}
if (finalStatus !== 'granted') {
return
}
console.log("Fetching token")
let token = await Notifications.getExpoPushTokenAsync()
console.log(token) // Not able to run this line to run. Code seems to be stuck on the above line.
}
Any help is much appreciated!
Update: I am on the latest version of the Expo Client App for iOS. In fact I installed and uninstalled the app multiple times to figure out the issue myself