use*_*745 19 apple-push-notifications dart flutter
我在推送通知方面遇到 Flutter 和 IOS 问题。
我的设置和有效的东西:
1)我安装了firebase_messaging: ^5.1.6没有错误的软件包/按照他们的所有IOS说明进行操作
2) 我已在 IOS 上征得用户许可并接受接收推送通知
3) 我能够在 IOS 和 Android 设备上获得 FCM 令牌
4)我在苹果开发者部分创建了一个密钥,并将密钥添加到 FCM
5)我在测试时关闭了应用程序/将其发送到后台 - 仍然没有运气
6) 我已经使用 Xcode 将 google-service-info 文件添加到 Runner
7) 我在 XCode 功能中添加了推送通知和后台通知
8) 我正在 iPhone 7 物理设备和物理 iPad 上进行测试
我使用 curl 向 IOS 设备发送通知
curl -X POST --header "Authorization: key=<myAuthKEY>" \
--Header "Content-Type: application/json" \
https://fcm.googleapis.com/fcm/send \
-d "{\"to\":\"<myDeviceKey>\",\"notification\":{\"body\":\"Hello\"},\"priority\":10}"
Run Code Online (Sandbox Code Playgroud)
我收到了来自 firebase 的成功响应
{"multicast_id":<SomeIdHere>,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"<SomeIdHere>"}]}
Run Code Online (Sandbox Code Playgroud)
这是我检索令牌的方法:
firebaseMessaging.getToken().then((String token) {
_authModel.setNotificationToken(token);
});
Run Code Online (Sandbox Code Playgroud)
当我在 IOS 上运行该应用程序时,我没有收到任何 Firebase 错误。
我已经折腾了 2 天了,所以有点烦人,以上所有内容似乎都适用于 Android。
任何建议,请。
颤振医生:
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, v1.9.1+hotfix.4, on Mac OS X 10.15 19A583, locale en-GB)
[?] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[?] Xcode - develop for iOS and macOS (Xcode 11.0)
[?] Android Studio (version 3.5)
[?] VS Code (version 1.38.1)
[?] Connected device (4 available)
• No issues found!
Run Code Online (Sandbox Code Playgroud)
我的 AppDelegate.m 文件
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
@import Firebase;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
Run Code Online (Sandbox Code Playgroud)
这不太漂亮,您可能需要提供更多详细信息,但请将此问题提交到https://github.com/FirebaseExtended/flutterfire/issues。否则,快速搜索iOS 推送通知问题会显示各种报告。这里有一些类似的,也许其中一个与您的相关?
5) I have closed the app / sent it to the background when testing - still no luck或者,如果您已经提交了一份,请分享链接!其他人可能会向您添加反馈。
| 归档时间: |
|
| 查看次数: |
12816 次 |
| 最近记录: |