簡體   English   中英

使用 RN Firebase 6.7.1 在 iOS 上停止顯示推送通知

[英]Push notifications stopped showing on iOS with RN Firebase 6.7.1

我的應用程序使用 RN Firebase 進行推送通知,它仍在6.7.1 刪除node_modules ,通知停止出現在 iOS 上。 我沒有對 GoogleService-Info.plist 或任何配置文件package.json做任何更改。

本機/RN 日志中沒有任何通知事件的蹤跡 他們仍然繼續在 Android 上正常工作。

在問題發生之前,我的最后一個package.json指定了 RN Firebase 的^6.4.0 - 我很可能使用它和其他包的相同版本。

FCM 顯示成功...

curl --header "Content-Type: application/json" \
--header "Authorization: key=AAA...my-server-key...oEw" \
https://fcm.googleapis.com/fcm/send \
-d '{"notification": {"title": "my notification", "body": "test message", "sound": "default"},
"priority": "high",
"to": "clV...my-fcm-token...CL9"}'

Response:
{
    "multicast_id":3203896278802626969,
    "success":1,
    "failure":0,
    "canonical_ids":0,
    "results": [
        {
            "message_id":"0:1601380177966694%89df1e3089df1e30"
        }
    ]
}

...但在客戶端上沒有通知的痕跡

2020-09-29 13:46:54.241363+0200 MyApp[10459:756113] 6.30.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://xxx.
2020-09-29 13:46:54.379384+0200 MyApp[10459:755952] [Firebase/Crashlytics] Version 4.4.0
2020-09-29 13:46:54.390700+0200 MyApp[10459:756110] 6.30.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60702000 started
2020-09-29 13:46:54.393020+0200 MyApp[10459:756110] 6.30.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://xxx)
2020-09-29 13:46:54.431519+0200 MyApp[10459:756111] 6.30.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2020-09-29 13:46:54.444616+0200 MyApp[10459:755952] +[RNFBCrashlyticsInitProvider isCrashlyticsCollectionEnabled] [Line 47] isCrashlyticsCollectionEnabled via RNFBMeta: 1
2020-09-29 13:46:54.444692+0200 MyApp[10459:755952] +[RNFBCrashlyticsInitProvider isCrashlyticsCollectionEnabled] [Line 50] isCrashlyticsCollectionEnabled: 1
2020-09-29 13:46:54.446565+0200 MyApp[10459:755952] +[RNFBCrashlyticsInitProvider configureWithApp:] [Line 71] initialization successful
2020-09-29 13:46:54.975676+0200 MyApp[10459:756115] 6.30.0 - [Firebase/Analytics][I-ACS031025] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2020-09-29 13:46:59.354475+0200 MyApp[10459:756131] 6.30.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2020-09-29 13:46:59.688 [info][tid:com.facebook.react.JavaScript] FirebaseService createNotificationListeners
2020-09-29 13:46:59.688 [warn][tid:com.facebook.react.JavaScript] Usage of "messaging().registerDeviceForRemoteMessages()" is not required. You only need to register if auto-registration is disabled in your 'firebase.json' configuration file via the 'messaging_ios_auto_register_for_remote_messages' property.
2020-09-29 13:47:00.062 [info][tid:com.facebook.react.JavaScript] 'FirebaseService checkMessagingPermission messaging 1', -1
2020-09-29 13:47:00.182 [info][tid:com.facebook.react.JavaScript] 'NotificationService TOKEN:', { token: '193...-token-...afe',
  os: 'ios' }
2020-09-29 13:47:00.248852+0200 MyApp[10459:756257] 6.30.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2020-09-29 13:47:00.382232+0200 MyApp[10459:756132] 6.30.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2020-09-29 13:47:02.619 [info][tid:com.facebook.react.JavaScript] 'NotificationService TOKEN:', { token: '193...-token-...afe',
  os: 'ios' }
2020-09-29 13:47:02.621 [info][tid:com.facebook.react.JavaScript] 'isNotificationsGranted() checkNotifications', { status: 'granted',
  settings: 
   { sound: true,
     badge: true,
     lockScreen: true,
     alert: true,
     notificationCenter: true } }
2020-09-29 13:47:02.627 [info][tid:com.facebook.react.JavaScript] 'FirebaseService checkPermission notifications 2', true
2020-09-29 13:47:02.628 [info][tid:com.facebook.react.JavaScript] 'FirebaseService checkPermission result 3', -1, true
2020-09-29 13:47:05.341 [info][tid:com.facebook.react.JavaScript] FirebaseService fcmToken 0
2020-09-29 13:47:05.435 [info][tid:com.facebook.react.JavaScript] 'isNotificationsGranted() checkNotifications', { status: 'granted',
  settings: 
   { sound: true,
     badge: true,
     lockScreen: true,
     alert: true,
     notificationCenter: true } }
2020-09-29 13:47:05.444 [info][tid:com.facebook.react.JavaScript] 'FirebaseService fcmToken 1', null
2020-09-29 13:47:05.732 [info][tid:com.facebook.react.JavaScript] 'FirebaseService fcmToken 2', 'clV...-my-fcm-token-...CL9'
2020-09-29 13:47:05.743 [info][tid:com.facebook.react.JavaScript] 'CaptureScreen this._user_id', 'clV...-my-fcm-token-...CL9'

iOS權限: iOS權限

已知可在 iOS 上運行的最后一個package.json

"dependencies": {
    "@react-native-community/push-notification-ios": "^1.4.1",
    "@react-native-firebase/analytics": "^6.4.0",
    "@react-native-firebase/app": "^6.4.0",
    "@react-native-firebase/crashlytics": "^6.4.0",
    "@react-native-firebase/iid": "^6.4.0",
    "@react-native-firebase/messaging": "^6.4.0",
    "react-native-push-notification": "^5.1.0",
    ...
}

當前安裝的版本npm ls --depth=0

├─┬ UNMET DEPENDENCY @react-native-community/push-notification-ios@1.5.0
│ └── invariant@2.2
├── UNMET DEPENDENCY @react-native-firebase/analytics@6.7.2
├─┬ UNMET DEPENDENCY @react-native-firebase/app@6.7.1
│ ├── @react-native-firebase/app-types@6.7.1
│ ├── opencollective-postinstall@2.0.3
│ └── superstruct@0.6.2
├── UNMET DEPENDENCY @react-native-firebase/auth@6.7.1
├─┬ UNMET DEPENDENCY @react-native-firebase/crashlytics@6.7.1
│ └── stacktrace-js@2.0.2
├── UNMET DEPENDENCY @react-native-firebase/iid@6.7.1
├── UNMET DEPENDENCY @react-native-firebase/messaging@6.7.1
├── UNMET DEPENDENCY react-native-push-notification@5.1.1

我在另一個項目中使用了錯誤的服務器密鑰。 Firebase 控制台不顯示任何內容,就好像一切順利。 此命令生成調試所需的輸出:

SERVER_KEY="AAA...my-server-key...oEw"
FCM_TOKEN="ef2...my-fcm-token...7PT"
curl --header "Content-Type: application/json" \
--header "Authorization: key=$SERVER_KEY" \
https://fcm.googleapis.com/fcm/send \
-d '{"notification": {"title": "my notification", "body": "test message", "sound": "default"},
"priority": "high",
"to": "'$FCM_TOKEN'"}'

第二個問題是 Firebase 代理已關閉 - 即上述命令返回成功時,但通知仍未出現在應用程序中,將其修復為: FirebaseAppDelegateProxyEnabled: YES

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM