简体   繁体   English

OneSignal和Xamarin iOS的问题

[英]Issue with OneSignal and Xamarin iOS

I'm using OneSignal service in my Xamarin iOS app, accord the documentation: https://documentation.onesignal.com/docs/xamarin-sdk-setup 我在我的Xamarin iOS应用程序中使用OneSignal服务,符合以下文档: https ://documentation.onesignal.com/docs/xamarin-sdk-setup

I've made all steps, BUT if i override the AppDelegate methods 我已经完成了所有步骤,但是如果我覆盖了AppDelegate方法

OnResignActivation
DidEnterBackground
WillEnterForeground
WillTerminate
OnActivated

I'm getting the next error: 我收到了下一个错误:

ObjCRuntime.RuntimeException: Cannot get the method descriptor for the selector 'oneSignalApplicationDidBecomeActive:' on the type 'AppDelegate', because the selector does not correspond to a method

I need to override those methods, what is my error? 我需要覆盖那些方法,我的错误是什么?

Thanks! 谢谢!

try this in your Application's AppDelegate 在你的应用程序的AppDelegate中试试这个

[Export ("oneSignalApplicationDidBecomeActive:")]
public void OneSignalApplicationDidBecomeActive(UIApplication application) {
    Console.WriteLine ("oneSignalApplicationDidBecomeActive:");
}

I was having a similar issue with oneSignalDidFailRegisterForRemoteNotification:error: 我遇到了与oneSignalDidFailRegisterForRemoteNotification类似的问题:错误:

Fixed with this code inside AppDelegate. 修复了AppDelegate中的这段代码。 Hope it helps 希望能帮助到你

[Export("oneSignalDidFailRegisterForRemoteNotification:error:")]
public void OneSignalDidFailRegisterForRemoteNotification(UIApplication app, NSError error)
    {
        Console.WriteLine("oneSignalDidFailRegisterForRemoteNotification:error:");
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM