I am following the sample code pretty much verbatim. (It seems the hardest part of Push Notifications is the whole cert/provisioning thing). In my FinishedLaunching method I've included:
UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge;
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
And then I have a breakpoint set in here:
public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
{
// This is the Id that we need to keep track of.
Console.WriteLine(deviceToken.ToString());
}
And I get the exception
System.Exception: Could not initialize an instance of the type 'MonoTouch.Foundation.NSString': the native 'initWithData:encoding:' method returned nil.
It is possible to ignore this condition by setting MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false.
Which means I basically can't do anything with the deviceToken. Seems to be a bug with Xamarin but I wanted to see if there is something obvious I'm missing. Thanks.
JB