【发布时间】:2018-10-10 21:23:00
【问题描述】:
我已经在 Flutter 应用中配置了 Firebase 消息传递。它使用firebase messaging plugin。我已根据自述文件中的“iOS 集成”部分进行配置。 Firebase 在 main.dart 中启动
void main() async {
final FirebaseMessaging _firebaseMessaging = new FirebaseMessaging();
_firebaseMessaging.requestNotificationPermissions();
_firebaseMessaging.configure(onMessage: processMessage,
onLaunch: processLaunch,
onResume: processResume);
String token = await _firebaseMessaging.getToken();
print("fcm token is: $token");
runApp(TestApp());
}
Future<dynamic> processMessage(Map<String, dynamic> map) async {
print("received message:");
print(map);
}
Future<dynamic> processLaunch(Map<String, dynamic> map) async {
print("processing launch");
print(map);
}
Future<dynamic> processResume(Map<String, dynamic> map) async {
print("processing resume");
print(map);
}
问题是应用没有收到令牌。所以我将应用程序部署到物理设备,应用程序启动,但没有看到任何与 fcm 相关的输出,并且没有显示 ui。我在 IDEA 中看到以下日志:
5.10.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: .
5.10.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
哪里有问题?
【问题讨论】:
标签: ios firebase dart flutter firebase-cloud-messaging