我尝试使用FCM推送通知,但仅在iOS中不起作用!
我试图更改BundleID(错误代码为xxxxxx), 但无法更改。 而且我在Firebase控制台上发送了推送通知,但无法发送。 Android设备成功。
主要(处于状态)
FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
@override
void initState(){
...
firebaseCloudMessaging_Listeners();
}
void firebaseCloudMessaging_Listeners() {
if (Platform.isIOS) iOS_Permission();
_firebaseMessaging.getToken().then((token){
print(token);
});
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print('on message $message');
},
onResume: (Map<String, dynamic> message) async {
print('on resume $message');
},
onLaunch: (Map<String, dynamic> message) async {
print('on launch $message');
},
);
}
void iOS_Permission() {
_firebaseMessaging.requestNotificationPermissions(
IosNotificationSettings(sound: true, badge: true, alert: true)
);
_firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings)
{
print("Settings registered: $settings");
});
}
错误
Configuring the default Firebase app...
6.5.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
6.5.0 - [Firebase/Core][I-COR000008] The project's Bundle ID is inconsistent with either the Bundle ID in 'GoogleService-Info.plist', or the Bundle ID in the options if you are using a customized options. To ensure that everything can be configured correctly, you may need to make the Bundle IDs consistent. To continue with this plist file, you may change your app's bundle identifier to 'xxxxxx'. Or you can download a new configuration file that matches your bundle identifier from https://console.firebase.google.com/ and replace the current one.
6.5.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60004000 started
6.5.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see -)
6.5.0 - [GoogleUtilities/AppDelegateSwizzler][I-SWZ001011] App Delegate Proxy is disabled.
Configured the default Firebase app __FIRAPP_DEFAULT.
6.5.0 - [Firebase/Core][I-COR000027] The library name (flutter-firebase_core) or version number (0.4.0+1) contain invalid characters. Only alphanumeric, dash, underscore and period characters are allowed.
Installing and launching... 14.0s
Synciflutter
Synciflutter: Settings registered: PushNotificationSettings {sound: true, alert: true, badge: true}
请帮助我...