'No APNS token specified' error getting token on iOS
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 28/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- firebase, ios, typescript
- 领域
- mobile-dev
调研方向
首先跟踪报告中的 firebaseInitialization 流程里对 firebase().messaging().registerDeviceForRemoteMessages() 和 getToken() 的调用,并以文档化的 GoogleService-Info.plist 和 app.entitlements 配置作为上下文。检查为什么在 iOS 上 isDeviceRegisteredForRemoteMessages 仍为 false。完成标准是设备注册成功,并且 getToken() 在没有 APNS-token 错误的情况下返回 FCM token。
由索引模型根据 Issue 内容生成。
描述
I have an issue using this plugin on iOS. I receive this error when trying to get Firebase token:
No APNS token specified before fetching FCM Token
I put GoogleService-Info.plist and app.entitlements in app/App_Resources/iOS as described in the documentation
I tried both with xcode 14.3.1 and 15.0-beta
these are the dependencies in package.json:
@nativescript/ios: 8.5.2
@nativescript/types: 8.5.0
@nativescript/core: 8.5.5
@nativescript/firebase-core: 3.1.0
@nativescript/firebase-messaging: 3.1.0
And this is the function called when the application is started:
async function firebaseInitialization() {
console.log("firebaseInitialization: start firebase registering");
const defaultApp = await firebase().initializeApp();
console.log("firebase initialized");
console.log("request for permission");
const enabled = await requestUserPermission()
try {
if (enabled) {
firebase().messaging().showNotificationsWhenInForeground = true
console.log("trying to get current token")
const token = await firebase().messaging().getToken()
console.log("current token: " + token)
//rest of the code
...
}
} catch (e) {
console.log("ERROR: " + e) //<-- the error is catched here
}
}
async function requestUserPermission() {
const authStatus = await firebase()
.messaging()
.requestPermission({
ios: {
alert: true,
},
});
const enabled = authStatus === AuthorizationStatus.AUTHORIZED || authStatus === AuthorizationStatus.PROVISIONAL;
if (enabled) {
console.log('Push notification authorized')
const didRegister = await firebase().messaging()
.registerDeviceForRemoteMessages();
return true
} else {
console.log('Push notification NOT authorized')
return false
}
}
This is the console output:
firbaseInitialization: start firebase registering
firebase initialized
request for permission
Push notification authorized
trying to get current token
ERROR: Error: No APNS token specified before fetching FCM Token
I seem to have done everything that is requested in the documentation. Any idea?
EDIT:
I tried to wrap the registerDeviceForRemoteMessages call in a try-catch statement. No exception is thrown, but after that, the registration status, checked with firebase().messaging().isDeviceRegisteredForRemoteMessages, is false
- 主要语言
- TypeScript
- 星标
- 62
- 派生
- 53
- 平均合并
- 8 天 4 小时
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NativeScript/firebase 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 48/100
NativeScript/firebase#292 ·
-
难度 3/5 1-2 天 新手友好度 35/100
NativeScript/firebase#289 ·
-
难度 4/5 3-5 天 新手友好度 35/100
NativeScript/firebase#288 · 4 个 reaction ·
-
bug ios
NativeScript/firebase#287 · 已指派 1 人 ·
-
Uh-Oh Shazam 未关闭
难度 4/5 3-5 天 新手友好度 20/100
NativeScript/firebase#286 ·
查看 NativeScript/firebase 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·