I'm having issues setting up push notifications for iOS on Flutter. Another dev tried adding too - had the same problem.
TL;DR: Can anyone get pushes running on iOS Flutter with clean new build from stable channel?
I followed setup steps described here: https://pub.dev/packages/firebase_messaging
Specifically:
Added lines in AppDelegate.swift
if #available(iOS 10.0, *) { UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate }
Pushes aren't coming. Neither when app in background, not at all.
I also tried another step - sending individual push. Send code in CURL looks like this:
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:key=AIza_legacy_key" \
-d \
'{
"to": "my_push_token",
"notification":
{"body": "test_body",
"title": "test_title"
},
"priority": "high",
}
' \
'https://fcm.googleapis.com/fcm/send'
And the response is always this type: - First request is InvalidRegistration - Second and next same calls is NotRegistered
Another person found similar problem this summer and posted on GitHub, but thread was closed: https://github.com/flutter/flutter/issues/30486
My Flutter doctor:
[✓] Flutter (Channel unknown, v1.12.13+hotfix.7, on Mac OS X 10.15.3 19D76, locale ru-UA)
• Flutter version 1.12.13+hotfix.7 at /Users/reiven/flutter
• Framework revision 9f5ff2306b (2 weeks ago), 2020-01-26 22:38:26 -0800
• Engine revision a67792536c
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/reiven/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio 3.6 Preview.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.7.5
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio 3.6 Preview.app/Contents
• Flutter plugin version 43.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (4 available)
• iPhone • 96c120610d684dbab7f5e4d036a7f48041755f96 • ios • iOS 12.3.1
• iPhone 11 Pro Max • 8ABC99D3-6C46-4A3D-968B-F5719AA92C97 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
• Chrome • chrome • web-javascript • Google Chrome 79.0.3945.130
• Web Server • web-server • web-javascript • Flutter Tools
p.s. Some things I've tried:
Magically things just started working yesterday evening. So first - just try now. If not working - recreate certificates and redo initialization steps. If still not working - pray and retry another day.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With