capacitor-community / fcm

Enable Firebase Cloud Messaging for Capacitor apps
https://capacitor.ionicframework.com/docs/
MIT License
237 stars 83 forks source link

question: Do we need to edit AppDelegate.swift? #96

Closed mesqueeb closed 2 years ago

mesqueeb commented 2 years ago

Some things to note about the AppDelegate.swift file:

https://github.com/capacitor-community/fcm/blob/master/example/ios/App/App/AppDelegate.swift#L81

Questions:

  1. Do we need to manually add all these methods for the FCM plugin to work? (the stuff below line 81)
  2. Do we need to include that #if USE_PUSH or not?

I'm sorry to ask so many questions, but I'm not familiar with Swift : S

stewones commented 2 years ago
  1. no, it's not required
  2. yes, but the #if USE_PUSH is optional, if you plan to implement push you need the whole block, otherwise you can remove it.
stewones commented 2 years ago

just for reference, on Capacitor migration guide they ask to remove the #if statement I didn't remove in the example app but it's working still

Screen Shot 2021-10-05 at 19 38 37

mesqueeb commented 2 years ago

@stewones thanks for the elaboration!

joshfoskett commented 2 years ago

@stewones In order to get push notifications to work on iOS, I had to add the following to my AppleDelegate.swift: https://d.joshf.xyz/LBSR8X, which is also documented here.

I just wanted to make sure that this was expected (and that there wasn't something I was missing), since I was under the impression that this package made it so that you didn't have to modify any native code. I also don't see this mentioned in the iOS setup (in the README).