react-native-firebase
react-native-firebase copied to clipboard
[📚] iOS Notification Images Incorrect / False Steps!
I just wasted an entire Saturday just trying to figure out how I am supposed to setup the Notification Service Extension.
Firstly, the steps shown do not match with the gifs! Someone should responsibly update either the code or the gifs please!
Secondly, it is never mentioned that the target should be in Objective-C. The reader has to figure it out once they reach the header file addition.
Thirdly, the use_frameworks! :linkage => :static simply does not make sense! If you create a new react native project you can see that the Podfile already has the following code
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
This creates a conflict and breaks the pod install.
Even if you manage to run pod install without getting errors, the build always fails. I keep getting unreadable amount of errors. I tried every possible solution but I do not think there is a way around this.
I am getting this:
** BUILD FAILED **
The following build commands failed:
ScanDependencies Library/Developer/Xcode/DerivedData/ProjectName-gwlcuumkhpwxjdcjuyzpugjhjmuz/Build/Intermediates.noindex/ProjectName.build/Debug-iphoneos/ImageNotification.build/Objects-normal/arm64/NotificationService.o ios/ImageNotification/NotificationService.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'ImageNotification' from project 'ProjectName')
Building workspace ProjectName with scheme ProjectName and configuration Debug
(2 failures)
Please someone at least add a disclaimer in the documentation page that with the latest versions of Xcode and React Native those steps might a complete waste of time.
Firstly, the steps shown do not match with the gifs!
What's different?
it is never mentioned that the target should be in Objective-C
I believe it was written before Swift in react-native was a thing?
Someone should responsibly update either the code or the gifs please!
This is an open source repository and we simply cannot be everywhere at once. We rely on community help. There's an edit button at the top right of the document, docs PRs are always always appreciated
use_frameworks! :linkage => :static simply does not make sense
It makes a lot of sense! If you do it the way the stock template Podfile has you are at the mercy of environment settings and such. But firebase-ios-sdk (our underlying native SDK) strictly requires it. So why leave it to chance? You can and should just remove all that conditional "maybe it will be static / maybe it won't" logic - delete it - and put use_frameworks! :linkage => :static in there. Then you know you are meeting the baseline expectations of the module
All this said...you might like the companion project Notifee --> https://github.com/invertase/notifee/blob/main/docs-react-native/react-native/docs/ios/remote-notification-support.md#add-the-notification-service-extension
Notifee handles the "local device notification" API surface area, with a little bit of help from react-native-firebase to receive remote FCM. It could perhaps satisfy your use case as well
Thank you for the response.
What's different?
The code shown in the gifs is different from what’s in the code block under step 2. This can be confusing for users, especially beginners.
I believe it was written before Swift in react-native was a thing?
With newer versions of Xcode, it’s possible that Swift is now the default for new targets, which might be worth mentioning in the documentation. While it may make sense to experienced iOS developers, I think it should be mentioned in the instructions, especially because this guide is probably for people setting up React Native Firebase for the first time, who might be beginners.
It makes a lot of sense!
I get what you’re saying now, but for someone not familiar with iOS development, this isn’t intuitive at all. A quick note in the docs explaining why would save a lot of confusion.
Notifee
I already use Notifee, but it doesn’t handle background fetch notifications. It might cover what I need, but I think it’s still a required step to follow the instructions in this guide to set up images in notifications.
By the way, I still haven’t figured out how to get images working with background notifications yet, even after following the guide. For context, I’m able to get images in foreground notifications, with Notifee, but that’s it.
I still do not understand why the build fails. The pod install is successful.
PRs are always always appreciated
(I would have made a PR if I was able to make it work somehow)
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.