-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[firebase_auth]: NotificationService extension not working since iOS SDK 11.0.0 #13346
Comments
New versions have been rolled out. Kindly try again with those and provide feedback. |
@SelaseKay still having the same issue using |
It seems, I have the same issue. iOS notifications worked properly with firebase_core: 3.3.0 and firebase_messaging: 15.0.4 versions. After update to firebase_core: 3.4.0 (and iOS Firebase/Core 11.0.0 respectively) pushes stopped to work. |
@SelaseKay looking at the error logs I had provided I think the problem is with the |
Xcode now shows me the error message |
After upgrading firebase dependencies we have the same problem now in our flutter project. |
@SelaseKay still having the same issue using |
Hey @OutdatedGuy - I noticed that the notification extension helper has changed on iOS. See the documentation for iOS notification extension here It seems you essentially should update the notification extension helper to something like this: @interface NotificationService () <NSURLSessionDelegate>
@property(nonatomic) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property(nonatomic) UNMutableNotificationContent *bestAttemptContent;
@end
@implementation NotificationService
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
// Modify the notification content here as you wish
self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]",
self.bestAttemptContent.title];
// Call FIRMessaging extension helper API.
[[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent
withContentHandler:contentHandler];
} Could you let me know if this works for you? If so, I can update the documentation for Flutter on the Firebase website 🙏 |
@russellwheatley, I tried with the updated The issue is in Error Logs
My Updated file
//
// NotificationService.m
// Image Notification
//
//
//
#import "NotificationService.h"
#import "FirebaseMessaging.h"
#import "FirebaseAuth.h" // Add this line if you are using FirebaseAuth phone authentication
#import <UIKit/UIKit.h> // Add this line if you are using FirebaseAuth phone authentication
@interface NotificationService () <NSURLSessionDelegate>
@property(nonatomic) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property(nonatomic) UNMutableNotificationContent *bestAttemptContent;
@end
@implementation NotificationService
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
if ([[FIRAuth auth] canHandleURL:url]) {
return YES;
}
return NO;
}
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
for (UIOpenURLContext *urlContext in URLContexts) {
[FIRAuth.auth canHandleURL:urlContext.URL];
}
}
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
// Modify the notification content here as you wish
self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]",
self.bestAttemptContent.title];
// Call FIRMessaging extension helper API.
[[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent
withContentHandler:contentHandler];
}
- (void)serviceExtensionTimeWillExpire {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
self.contentHandler(self.bestAttemptContent);
}
@end
|
@russellwheatley I was testing some things out and replaced Modules Issue (Xcode): Definition of 'FIRAuth' must be imported from module 'FirebaseAuth.Swift' before it is required |
@russellwheatley finally made it work by replacing #import "FirebaseMessaging.h"
#import "FirebaseAuth.h" // Add this line if you are using FirebaseAuth phone authentication with just #import "Firebase.h" Do you know why this is happening? Does this have any repercussions like increase in app size? |
Is there an existing issue for this?
Which plugins are affected?
Auth, Messaging
Which platforms are affected?
iOS, macOS
Description
The
NotificationService
extension to handle images from firebase messaging payload on iOS and macOS has stopped working since upgraded packages with iOS SDK 11.0.0.Before upgrading all package that uses iOS 11.0.0 the
NotificationService
extension was working and compiling perfectly. But after upgrading packages I'm getting following error while compiling flutter app on iOS:Error Logs
NotificationService.m
Podfile
Reproducing the issue
firebase_core >= 3.4.0
,firebase_messaging >=15.1.0
&firebase_auth >= 5.2.0
Firebase Core version
3.4.1
Flutter Version
3.24.3
Relevant Log Output
No response
Flutter dependencies
Expand
Flutter dependencies
snippetAdditional context and comments
No response
The text was updated successfully, but these errors were encountered: