У меня есть проект ionic 3, который с помощью cordova-fcm-plugin для отправки push-уведомлений firebase работал правильно как в iOS, так и в Android.
после некоторых изменений кода или когда я создал новый проект в качестве демонстрационной версии для разработчика приложений, уведомления отправляются не только на устройства iOS.
похоже, что устройство получает токен, но не может получать уведомления. Пожалуйста, кто-нибудь может мне помочь или дать подсказку, чтобы решить эту проблему.
Я протестировал яблочные сертификаты (провизии, APN для песочницы и производства, учетную запись firebase, ключ авторизации .p8) и загрузил их в консоль firebase.
это мой plist файл.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>285076718059-1shl4sl5if4hqf8pkef79qlsg3pjhvcn.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.285076718059-1shl4sl5if4hqf8pkef79qlsg3pjhvcn</string>
<key>API_KEY</key>
<string>AIzaSyDJB29EvhJRR4vd8dGzsWNoc6blJgfzOiE</string>
<key>GCM_SENDER_ID</key>
<string>285076718059</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.needion.ionic.fcm</string>
<key>PROJECT_ID</key>
<string>fcm-test-a8882</string>
<key>STORAGE_BUCKET</key>
<string>fcm-test-a8882.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:285076718059:ios:a730549029aeb07c</string>
<key>DATABASE_URL</key>
<string>https://fcm-test-a8882.firebaseio.com</string>
</dict>
</plist>
когда я запускаю приложение на iphone 5s, подключенном к xcode, журнал консоли
> 2019-07-03 17:52:03.067441+0300 FCM TEST N[534:58649]
> DiskCookieStorage changing policy from 2 to 0, cookie file:
> file:///private/var/mobile/Containers/Data/Application/AD139928-3F08-42D6-89D8-936D7235EF39/Library/Cookies/Cookies.binarycookies
> 2019-07-03 17:52:03.840960+0300 FCM TEST N[534:58649] You've
> implemented -[<UIApplicationDelegate>
> application:didReceiveRemoteNotification:fetchCompletionHandler:], but
> you still need to add "remote-notification" to the list of your
> supported UIBackgroundModes in your Info.plist. 2019-07-03
> 17:52:03.849622+0300 FCM TEST N[534:58649] Apache Cordova native
> platform version 4.5.5 is starting. 2019-07-03 17:52:03.851128+0300
> FCM TEST N[534:58649] Multi-tasking -> Device: YES, App: YES
> 2019-07-03 17:52:03.866470+0300 FCM TEST N[534:58649]
> CDVWKWebViewEngine: trying to inject XHR polyfill 2019-07-03
> 17:52:03.953573+0300 FCM TEST N[534:58649] CDVWKWebViewEngine will
> reload WKWebView if required on resume 2019-07-03 17:52:03.953835+0300
> FCM TEST N[534:58649] Using Ionic WKWebView 2019-07-03
> 17:52:03.955018+0300 FCM TEST N[534:58649] [CDVTimer][console]
> 0.223994ms 2019-07-03 17:52:03.955392+0300 FCM TEST N[534:58649] [CDVTimer][handleopenurl] 0.193954ms 2019-07-03 17:52:03.959248+0300
> FCM TEST N[534:58649] [CDVTimer][intentandnavigationfilter] 3.769994ms
> 2019-07-03 17:52:03.959532+0300 FCM TEST N[534:58649]
> [CDVTimer][gesturehandler] 0.162005ms 2019-07-03 17:52:03.959734+0300
> FCM TEST N[534:58649] CDVIonicKeyboard: resize mode 1 2019-07-03
> 17:52:03.975516+0300 FCM TEST N[534:58649] [CDVTimer][keyboard]
> 15.761971ms 2019-07-03 17:52:03.986249+0300 FCM TEST N[534:58649] [CDVTimer][splashscreen] 10.558009ms 2019-07-03 17:52:03.998451+0300
> FCM TEST N[534:58649] [CDVTimer][statusbar] 12.035966ms 2019-07-03
> 17:52:03.998584+0300 FCM TEST N[534:58649]
> [CDVTimer][TotalPluginStartup] 43.956995ms 2019-07-03
> 17:52:04.029467+0300 FCM TEST N[534:58649]
> DidFinishLaunchingWithOptions 2019-07-03 17:52:04.040:
> <FIRMessaging/INFO> FIRMessaging library version 1.2.0 2019-07-03
> 17:52:04.144231+0300 FCM TEST N[534:58761]
> [Firebase/Core][I-COR000001] Configuring the default app. 2019-07-03
> 17:52:04.179: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy
> enabled, will swizzle app delegate remote notification handlers. To
> disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and
> set it to NO 2019-07-03 17:52:04.179: <FIRInstanceID/WARNING> Failed
> to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
> 2019-07-03 17:52:04.185: <FIRMessaging/WARNING> FIRMessaging
> AppDelegate proxy enabled, will swizzle app delegate remote
> notification receiver handlers. Add "FirebaseAppDelegateProxyEnabled"
> to your Info.plist and set it to NO 2019-07-03 17:52:04.448:
> <FIRInstanceID/WARNING> Error while reading embedded mobileprovision
> Error Domain=NSCocoaErrorDomain Code=260 "The file
> “embedded.mobileprovision” couldn’t be opened because there is no such
> file."
> UserInfo={NSFilePath=/var/containers/Bundle/Application/234854F1-174B-491B-95CB-766AA63DBC0A/FCM
> TEST N.app/embedded.mobileprovision, NSUnderlyingError=0x28304ee80
> {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
> 2019-07-03 17:52:04.144 FCM TEST N[534] <Debug>
> [Firebase/Core][I-COR000001] Configuring the default app.
> ================================================================= Main Thread Checker: UI API called on a background thread: -[UIApplication
> delegate] PID: 534, TID: 58752, Thread name: (none), Queue name:
> FIRAnalyticsQueue, QoS: 9 Backtrace: 4 FCM TEST N
> 0x00000001008c6720 __38+[FIRAnalytics
> createAppDelegateProxy]_block_invoke + 56 5 libdispatch.dylib
> 0x0000000100b08c74 _dispatch_client_callout + 16 6 libdispatch.dylib
> 0x0000000100b0ac84 _dispatch_once_callout + 84 7 FCM TEST N
> 0x00000001008c567c __47+[FIRAnalytics
> startWithConfiguration:options:]_block_invoke_2 + 104 8
> libdispatch.dylib 0x0000000100b076f0
> _dispatch_call_block_and_release + 24 9 libdispatch.dylib 0x0000000100b08c74 _dispatch_client_callout + 16 10 libdispatch.dylib
> 0x0000000100b10bf4 _dispatch_lane_serial_drain + 712 11
> libdispatch.dylib 0x0000000100b118b4
> _dispatch_lane_invoke + 456 12 libdispatch.dylib 0x0000000100b1b77c _dispatch_workloop_worker_thread + 1148 13
> libsystem_pthread.dylib 0x00000001e4779114
> _pthread_wqthread + 304 14 libsystem_pthread.dylib 0x00000001e477bcd4 start_wqthread + 4 2019-07-03 17:52:05.229732+0300
> FCM TEST N[534:58752] [reports] Main Thread Checker: UI API called on
> a background thread: -[UIApplication delegate] PID: 534, TID: 58752,
> Thread name: (none), Queue name: FIRAnalyticsQueue, QoS: 9 Backtrace:
> 4 FCM TEST N 0x00000001008c6720
> __38+[FIRAnalytics createAppDelegateProxy]_block_invoke + 56 5 libdispatch.dylib 0x0000000100b08c74
> _dispatch_client_callout + 16 6 libdispatch.dylib 0x0000000100b0ac84 _dispatch_once_callout + 84 7 FCM TEST N
> 0x00000001008c567c __47+[FIRAnalytics
> startWithConfiguration:options:]_block_invoke_2 + 104 8
> libdispatch.dylib 0x0000000100b076f0
> _dispatch_call_block_and_release + 24 9 libdispatch.dylib 0x0000000100b08c74 _dispatch_client_callout + 16 10 libdispatch.dylib
> 0x0000000100b10bf4 _dispatch_lane_serial_drain + 712 11
> libdispatch.dylib 0x0000000100b118b4
> _dispatch_lane_invoke + 456 12 libdispatch.dylib 0x0000000100b1b77c _dispatch_workloop_worker_thread + 1148 13
> libsystem_pthread.dylib 0x00000001e4779114
> _pthread_wqthread + 304 14 libsystem_pthread.dylib 0x00000001e477bcd4 start_wqthread + 4 2019-07-03 17:52:22.511413+0300
> FCM TEST N[534:58649] ERROR Internal navigation rejected -
> <allow-navigation> not set for url='gap://ready' 2019-07-03
> 17:52:22.540226+0300 FCM TEST N[534:58649] Cordova view ready
> 2019-07-03 17:52:22.569745+0300 FCM TEST N[534:58649] FCMPlugin.js: is
> created 2019-07-03 17:52:22.570094+0300 FCM TEST N[534:58649]
> deviceready has not fired after 5 seconds. 2019-07-03
> 17:52:22.570445+0300 FCM TEST N[534:58649] Channel not fired:
> onCordovaInfoReady 2019-07-03 17:52:22.570928+0300 FCM TEST
> N[534:58649] WARN: Ionic Native: deviceready did not fire within
> 5000ms. This can happen when plugins are in an inconsistent state. Try
> removing plugins from plugins/ and reinstalling them. 2019-07-03
> 17:52:22.571247+0300 FCM TEST N[534:58649] Ionic Native: deviceready
> event fired after 17373 ms 2019-07-03 17:52:22.581241+0300 FCM TEST
> N[534:58649] Start fcm 2019-07-03 17:52:22.581504+0300 FCM TEST
> N[534:58649] get Token 2019-07-03 17:52:22.582623+0300 FCM TEST
> N[534:58649] view registered for notifications 2019-07-03
> 17:52:22.619341+0300 FCM TEST N[534:58761] <FIRAnalytics/INFO>
> Firebase Analytics v.3403000 started 2019-07-03 17:52:22.619 FCM TEST
> N[534:] <FIRAnalytics/INFO> Firebase Analytics v.3403000 started
> 2019-07-03 17:52:22.626460+0300 FCM TEST N[534:58649] FCMPlugin Ready
> OK 2019-07-03 17:52:22.627297+0300 FCM TEST N[534:58761]
> <FIRAnalytics/INFO> To enable debug logging set the following
> application argument: -FIRAnalyticsDebugEnabled (..) 2019-07-03
> 17:52:22.629 FCM TEST N[534:] <FIRAnalytics/INFO> To enable debug
> logging set the following application argument:
> -FIRAnalyticsDebugEnabled (see ..) 2019-07-03 17:52:22.629635+0300 FCM TEST N[534:58761] <FIRAnalytics/INFO> Successfully created Firebase
> Analytics App Delegate Proxy automatically. To disable the proxy, set
> the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
> 2019-07-03 17:52:22.629 FCM TEST N[534:] <FIRAnalytics/INFO>
> Successfully created Firebase Analytics App Delegate Proxy
> automatically. To disable the proxy, set the flag
> FirebaseAppDelegateProxyEnabled to NO in the Info.plist 2019-07-03
> 17:52:22.693243+0300 FCM TEST N[534:58649] mytoken: null 2019-07-03
> 17:52:22.769162+0300 FCM TEST N[534:58756]
> [Firebase/Core][I-COR000019] Clearcut post completed. 2019-07-03
> 17:52:22.769 FCM TEST N[534] <Debug> [Firebase/Core][I-COR000019]
> Clearcut post completed. 2019-07-03 17:52:23.272059+0300 FCM TEST
> N[534:58761] <FIRAnalytics/WARNING> The AdSupport Framework is not
> currently linked. Some features will not function properly. Learn more
> at .. 2019-07-03 17:52:23.272 FCM TEST N[534:] <FIRAnalytics/WARNING>
> The AdSupport Framework is not currently linked. Some features will
> not function properly. Learn more at .. 2019-07-03
> 17:52:23.523951+0300 FCM TEST N[534:58761] <FIRAnalytics/INFO>
> Firebase Analytics enabled 2019-07-03 17:52:23.524 FCM TEST N[534:]
> <FIRAnalytics/INFO> Firebase Analytics enabled 2019-07-03
> 17:52:23.728988+0300 FCM TEST N[534:58649] InstanceID token: (null)
> 2019-07-03 17:52:23.729114+0300 FCM TEST N[534:58649]
> stringByEvaluatingJavaScriptFromString
> FCMPlugin.onTokenRefreshReceived('(null)'); 2019-07-03
> 17:52:23.737230+0300 FCM TEST N[534:58649] mytoken: (null) 2019-07-03
> 17:52:29.535078+0300 FCM TEST N[534:58649] InstanceID token:
> ftHR8zaqJfE:APA91bEsteOHB57Q8E9BotHOiNh7sVUkzX4ebxjlCGucXvFZ979-jvmH_Mom1A124Di2Q2cIJkL0P3CzToQfajslMRF0dlAf3Q7LIwUfmCpDC21S8KzGiqPuahzA8zPY0y-63iLZ0vlP
> 2019-07-03 17:52:29.535310+0300 FCM TEST N[534:58649]
> stringByEvaluatingJavaScriptFromString
> FCMPlugin.onTokenRefreshReceived('ftHR8zaqJfE:APA91bEsteOHB57Q8E9BotHOiNh7sVUkzX4ebxjlCGucXvFZ979-jvmH_Mom1A124Di2Q2cIJkL0P3CzToQfajslMRF0dlAf3Q7LIwUfmCpDC21S8KzGiqPuahzA8zPY0y-63iLZ0vlP');
> 2019-07-03 17:52:29.553166+0300 FCM TEST N[534:58649] mytoken:
> ftHR8zaqJfE:APA91bEsteOHB57Q8E9BotHOiNh7sVUkzX4ebxjlCGucXvFZ979-jvmH_Mom1A124Di2Q2cIJkL0P3CzToQfajslMRF0dlAf3Q7LIwUfmCpDC21S8KzGiqPuahzA8zPY0y-63iLZ0vlP
> 2019-07-03 17:52:30.154132+0300 FCM TEST N[534:58649] Connected to
> FCM. 2019-07-03 17:52:30.170: <FIRMessaging/WARNING> Failed to
> subscribe to topic Error Domain=com.google.fcm Code=5 "(null)"
> 2019-07-03 17:52:30.171: <FIRMessaging/WARNING> Failed to subscribe to
> topic Error Domain=com.google.fcm Code=5 "(null)" 2019-07-03
> 17:52:50.671566+0300 FCM TEST N[534:58649] app become active
> 2019-07-03 17:52:50.671692+0300 FCM TEST N[534:58649] Set state
> foreground 2019-07-03 17:52:50.965171+0300 FCM TEST N[534:58649]
> Connected to FCM.