Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Can not register for APNS

$
0
0

Hello Guys!

I have another question (probably lame one).

So I have a simple code that is supposed to register for APNS. I have all certificates and profiles set up on my Apple account. So in AppDelegate.cs in FinishedLaunching method I added:

UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge);

and I also added two methods:

public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken) { DeviceTokenHolder.deviceToken = deviceToken.ToString(); DeviceTokenHolder.registered = true; new UIAlertView ("APNS", "Registered. Token: " + deviceToken.ToString(), null, "OK", null).Show(); }

public override void FailedToRegisterForRemoteNotifications (UIApplication application, NSError error) { new UIAlertView ("APNS", "Failed register", null, "OK", null).Show(); }

THe problem is that when I launch the app on my iPhone I never reach the RegisteredForRemoteNotifications method nor FailedToRegisterForRemoteNotifications (I set up breakpoints). When I launch the app on iPhone simulator FailedToRegisterForRemoteNotifications is of course invoked.

A same code that uses the same certificates, but written in Objective C in Xcode, works like a charm and I get token immediately.

I am using Xamarin trial license.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>