Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I've made all steps, BUT if i override the AppDelegate methods

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!

like image 237
Ollie Strevel Avatar asked Mar 03 '16 00:03

Ollie Strevel


2 Answers

try this in your Application's AppDelegate

[Export ("oneSignalApplicationDidBecomeActive:")]
public void OneSignalApplicationDidBecomeActive(UIApplication application) {
    Console.WriteLine ("oneSignalApplicationDidBecomeActive:");
}
like image 157
max Avatar answered Nov 11 '22 17:11

max


I was having a similar issue with oneSignalDidFailRegisterForRemoteNotification:error:

Fixed with this code inside AppDelegate. Hope it helps

[Export("oneSignalDidFailRegisterForRemoteNotification:error:")]
public void OneSignalDidFailRegisterForRemoteNotification(UIApplication app, NSError error)
    {
        Console.WriteLine("oneSignalDidFailRegisterForRemoteNotification:error:");
    }
like image 33
Luca Pisano Avatar answered Nov 11 '22 17:11

Luca Pisano