'No APNS token specified' error getting token on iOS
まだ誰も着手していません。
評価
- 難易度
- 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 トークンを返せば完了です。
索引モデルが 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時間
- マージ済み PR(30日)
- 2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
-
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 ·