Closed ktaze1 closed 3 years ago
After some research I found that I didn't include the necessary Interfaces. AppDelegate
class should look like this.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate, IUNUserNotificationCenterDelegate, IMessagingDelegate
{
//...
}
I was following this tutorial to implement notifications through FCM. At their Register for remote notifications section there is a code snippet:
Project.iOS/AppDelegate.cs:
So seems like there are no problem but when I implemented this to my MBB hybrid project the line:
UNUserNotificationCenter.Current.Delegate = this;
gives an error, sayingCannot implicitly convert type 'MyApp.iOS.AppDelegate' to UserNotifications.IUNUserNotificationsCenterDelegate'. An explicit conversion exists
It won't let me compile but if I explicitly cast it into what it wants it also gives error.
Found another example of Xamarin Forms at this post (I translated mostly since I don't know Spanish) and they're doing the same.
Steps to Reproduce
UNUserNotificationCenter.Current.Delegate = this;
gives error ofError CS0266 Cannot implicitly convert type 'Project.iOS.AppDelegate' to 'UserNotifications.IUNUserNotificationCenterDelegate'. An explicit conversion exists (are you missing a cast?)
Expected Behavior
Actual Behavior
Environment
Build Logs
Example Project (If Possible)
https://github.com/ktaze1/CugemderMobileApp