-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[📚] Issues while seting up iOS notification images - iOS Notification Images #7632
Comments
Super helpful finding this post today. Thanks for sharing your findings! |
hi @darlanhms so i followed your guide and its great and worked before but since i needed clean build i prebuild with expo and now this step fix: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead. doesnt work, any suggestion? my Podfile:
|
Thank you so much for help, I did everything to fix the issue. Build and run all works, but the image didn't show, did you do anything to make the image show in app notifcation? |
@JamesZhao2022 another thing that I had to do was unbind this framework and bind again (click on it and It is important to have it as "Do Not Embed" cause you'll have problems sending it to app store later. |
by following these instructions, the build error fixed but only notifications with images still not showing |
I also had these problems (except the sharedApplication one) and still can't make images appear on the notification. Even though the Notification Service extension is running (I'm modifying the title and it appears in my device). Maybe it is a problem of firebase-ios-sdk? |
I tried to update the title but it is not appearing on my device. Can you please share your Notification Service file? |
It's just the autogenerated one with the #import "NotificationService.h"
#import "FirebaseMessaging.h"
@interface NotificationService ()
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) 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...
// self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];
// self.contentHandler(self.bestAttemptContent);
[[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 In my case, I noticed it is working but it seems like URL has to specify the image extension. As in:
Not really sure if this is the same problem other people are having, but it is indeed a different behavior from Android where both URLs would work. |
I followed the guide provided by @darlanhms to add the |
I got the same
I got the same error. I moved the target ImageNotification to the end of file and it worked. |
Thanks for sending through @binle. The pod is in my Podfile.lock so it appears the pod installed correctly |
@Salakar @mikehardy @Lyokone Do we have any update on this? |
Encountered the same error. Then realised that I misunderstood the instructions regarding the pod file. Instructions say to paste the following code "at the end of the pod file". target 'ImageNotification' do But what it actually means is that you have to paste it outside of the main target block in the pod file: target 'yourMainApp' do ... rest of code... end target 'ImageNotification' do If you paste the the above target 'ImageNotification' block of code within the main target block (which is what i did initially), you will encounter build error in Xcode 'sharedApplication' is unavailable: not available on iOS. So the solution is to ensure your pod file is configured as above. The new target block must be OUTSIDE of the main target block (i.e. 'at the end of the pod file'). Then quit Xcode. Then in the terminal, go to project folder --> cd iOS --> pod deintegrate --> then pod install. Then open Xcode, wait for it re-index files, clean folder, clear issues, then rebuild the app. |
The missing information was to create new Bundle Id and Provisioning profiles Steps
|
@Santhosh-Umapathi could you be a bit more specific what you mean by "Provide New Bundle Id and Provisioning Profiles"? Thank you! |
@irvinsingGitHub When following your advice, I get the error that "FirebaseMessaging.h" can't be found. How did you manage to resolve this? Thanks :) |
You forgot to follow Step 2 (Mainly the third line of code) and run pod-install after it |
Anyone made it work with Xcode version 16.0 ? My build fails after I add the target... |
Summary: I followed every step on iOS Notification Images section and I still had some issues building my application, I managed to solve em' but I don't know if it is worth documenting. (It is a expo bare workflow BTW). It wasn't an error with this library itself and it is probably some annoying ios configuration, I just think it is helpful to share if someone is having the same issues.
Unable to integrate the following embedded targets with their respective host targets (a host target is a "parent" target which embeds a "child" target like a framework or extension)
This issue always occurs when I put
target 'ImageNotification' do ...
at the end of the file.I solved it by putting it before the last
end
tag.Cycle inside ...; building could produce unreliable results. Cycle details: → Target '...': ExtractAppIntentsMetadata
I solved it by clicking on xcode project, Targets -> Build Phases and dragging "Embed Frameworks" above "Compile Sources"
'sharedApplication' is unavailable: not available on iOS
I solved it by pasting the following code to
Podfile
. It disables that option on every pod.[Sandbox: bash(72986) deny(1) file-write-data /Users/XXX/ios/Pods/resources-to-copy-XXXShareExtension.txt
I solved it by going to xcode project Build Settings and setting
User Script Sandboxing
to 'No'I'm not experienced at writing issues, if the issue is bad written or not related just close it.
The text was updated successfully, but these errors were encountered: