Deployment target is set to 14.0 for all parts of my app (Main app, Widget extension, Watch extension and this one as well). So I doubt it could cause this issue.
Post
Replies
Boosts
Views
Activity
The line with " if let bestAttemptContent = bestAttemptContent {" is in the template of Xcode and does not come from Google at all. That is how Xcode creates this service extension if added.
And the print yields nothing because it is never getting called. I receive the push on my device but this extension won't get called for some reason..
Thanks for the reply.
The line you mentioned is from the template that Xcode generates if you create such an extension. So if this is the problem, Apple included a not working template which would be very bad.
The debugger is also never hit if I place breakpoints in it, even if they are on line one of the function.
And yes, FCM is the Firebase Cloud Messaging which seems to work (I get push notifications at least but I don't know if something prevents it from including the mutable content flag; tried "mutable-content" as from Apples documentations as well as "mutable_content" from the FCM documentation).
For everyone with the same problem: Seems like it is an issue with iOS 13 and newer as described here: swiftydorado.github(dot)io/posts/2020-01-18-multipeer-connectivity/
It seems that after introducing the new SceneDelegate on iOS 13, MCAdvertiserAssistant is not working properly.
@OOPer first of all: Thanks for your detailed explanation and help. Many of the topics you pointed out are also issues in other parts of my app (and I was already wondering why it sometimes acted in a strange manner). Learning Swift is really different compared to C Sharp (why does the hash symbol starts formatting here?) and C++. Seems like it works now as expected but I got a new question based on your response. Is there a specific reason you put the Add/Remove methods from the ViewModel into an Extension to Player instead of the Player itself? Is this just to keep it seperated or does it provide any other advantage I do not notice right now?
Thanks for the reply. Seems like I only had to do two changes. One is making my Player class inherit from ObservableObject and two is switching my @State to @ObservedObject for the player. I thought that @ObservedObject is only for things like ViewModels but totally overseen the fact that in this case my Model became my ViewModel for this Control.
Seems like I still have a long way to learn how to apply Swift and SwiftUI correctly - especially the architecture part. Anyway, thanks for your reply it just fixed all errors I still had.