Push Notification, alert message not receiving on iPhone

I am working on Push notifications for iPhone. I am sending notification on button click, but the iPhone developer is not receiving the alert message. Can anyone plz help me? This is my method --

protected void btnPush_Click(object sender, EventArgs e)
{
    string devicetoken = "bhsdse78 d52c6a34 273de5f7 27947945 24736e36 33d93a6c 3147a416 434995eb";
    try
    {
        if (devicetoken != "")
        {
            //lblError.Visible = false;
            string p12FileName = "D:/Worksapace/Coupzila/Certificates(3).p12"; // change this to reflect your own certificate
            string p12Password = "seas"; // change this
            bool sandBox = true;
            int numConnections = 1; // you can change the number of connections here
            var notificationService = new NotificationService(sandBox, p12FileName, p12Password, numConnections);
            var deviceToken = devicetoken; // put in your device token here
            var notification = new Notification(deviceToken);

            notification.Payload.Alert.Body = "Hi this is push notification test message.";
            notification.Payload.Sound = "default";
            notification.Payload.Badge = 1;
            notification.Payload.HideActionButton = true;
            if (notificationService.QueueNotification(notification))
            { }
            else
            { }
            // This ensures any queued notifications get sent befor the connections are closed
            notificationService.Close();
            notificationService.Dispose();

        }
        else
        {
           //lblError.Visible = true;
        }

    }
    catch (Exception ex)
    {

    }
}

This method is running successfully, but not getting notifications on iPhone, Whtz problem in my code? Help me out, Thanks in advance

Answers


First, Remove the empty characters from your deviceToken.

Second, Put @ sign for your fileName;

string p12FileName = @"D:/Worksapace/Coupzila/Certificates(3).p12";

And for the last step implement your catch, like;

    catch (Exception ex)
    {
        MessageBox.Show("There is an error from push notification. Details:\n" + ex);
    }

And good with Apple.


Need Your Help

Codesign error in Xamarin Studio 5.9.7 (build 9) and Xamarin.iOS 9.0.1.18

ios xamarin xamarin.ios xamarin-studio

I have upgraded Xamarin Studio to the latest version in the beta channel. When I try to run the app I get the following error:

Open custom IE window from Flex or Can a window customize itself?

php javascript html flex

Is it possible to open a custom IE window (i.e no status bar or address bar etc) from within flex? or if i call a php file or html file can the page customize itself when loaded?