- Передний план: уведомления получены и успешно обработаны.
- Фон или Прекращено: уведомления не приходят, и я не могу с ними справиться.
Версии
Код: Выделить всё
Flutter 3.24.5 • channel stableКод: Выделить всё
Xcode Version 16.1Код: Выделить всё
firebase_messaging: ^15.1.6Код: Выделить всё
flutter_local_notifications: ^18.0.1Код: Выделить всё
IOS 18
Код: Выделить всё
@pragma('vm:entry-point')
Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
print("Handling a background message: ${message.messageId}");
// Firebase'i başlatın
// Burada bildirimi işleyebilirsiniz
}
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform, // Firebase config dosyasını doğru şekilde eklediğinizden emin olun.
);
NotificationSettings settings = await FirebaseMessaging.instance.requestPermission(
alert: true,
announcement: false,
badge: true,
carPlay: false,
criticalAlert: false,
provisional: false, // Zorunlu bildirim yerine geçici izni aktive eder
sound: true,
);
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
runApp(MyApp());
}
Код: Выделить всё
import UIKit
import Flutter
import Firebase
import FirebaseCore
import flutter_local_notifications
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// This is required to make any communication available in the action isolate.
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
GeneratedPluginRegistrant.register(with: registry)
}
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
Код: Выделить всё
{
"message": {
"token": "",
"data": {
"receiver-id": "HBJq0SpqsrtoWjwIaH7kky14g4VZl53",
},
"notification": {
"title": "Test Notification",
"body": "This is a test message",
},
"apns": {
"headers": {
"apns-priority": "10"
},
"payload": {
"aps": {
"content-available": 1
}
}
}
}
}
Код: Выделить всё
CADisableMinimumFrameDurationOnPhone
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
Snapstory
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
snapstory
CFBundlePackageType
APPL
CFBundleShortVersionString
$(FLUTTER_BUILD_NAME)
CFBundleSignature
????
CFBundleURLTypes
CFBundleTypeRole
Editor
CFBundleURLSchemes
com.googleusercontent...
CFBundleVersion
$(FLUTTER_BUILD_NUMBER)
FirebaseAppDelegateProxyEnabled
LSRequiresIPhoneOS
NSCameraUsageDescription
Image Picker
NSMicrophoneUsageDescription
Image Picker
NSPhotoLibraryUsageDescription
Image Picker
UIApplicationSupportsIndirectInputEvents
NSPhotoLibraryAddUsageDescription
Fotoğraf kütüphanesine fotoğraf kaydetmek için izin gerekiyor.
UISupportsDocumentBrowser
UIBackgroundModes
processing
fetch
remote-notification
BGTaskSchedulerPermittedIdentifiers
dev.flutter.background.refresh
UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
Main
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UISupportedInterfaceOrientations~ipad
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
Код: Выделить всё
FirebaseAppDelegateProxyEnabled
Подробнее здесь: https://stackoverflow.com/questions/792 ... ng-for-ios
Мобильная версия