views:

313

answers:

1

Hi guys,

I need a way to test Push notification feedback service. I can send the notifications fine.

I installed the app using XCode to my dev IPod, sent push notifications just fine, the app received them ok.

I uninstalled the app, sent a few push notifications. Then tried the feedback service, but no luck. I do not receive any bytes back from the stream.

Even tried waiting for upto a day. Tried the same on a different iphone, but nothing. I am sure the code is fine, double checked the url and port etc, all fine. Besides using the same settings (apart from url and port) I can send the pushes just fine.

So I am not sure what to do now. I have searched on the web, but could not find anything useful. Someone suggested exactly what i have already tried (send push -> uninstall -> send push -> listen for feedback).

Any ideas? Any way ican make sure that its fine before pushing it live?

Below is the code (C#):

using (TcpClient client = new TcpClient())
        {
            client.Connect("feedback.sandbox.push.apple.com", 2196);
            using (NetworkStream networkStream = client.GetStream())
            {
                Console.Out.WriteLine("Client Connected");
                X509Certificate cert = new X509Certificate(fileLocation, password);
                X509CertificateCollection certCollection = new X509CertificateCollection(new X509Certificate[1] { cert });
                SslStream ssl = new SslStream(client.GetStream(), true, new RemoteCertificateValidationCallback(ValidateServerCertificate), null);                    
                try
                {
                    int bytesRead;
                    byte[] b = new byte[38];
                    ssl.AuthenticateAsClient("feedback.sandbox.push.apple.com", certCollection, SslProtocols.Default, false);
                    do
                    {
                        bytesRead = ssl.Read(b, 0, b.Length);
                    }
                    while (bytesRead != 0);
                    ssl.Close();
                }
                catch (AuthenticationException e)
                {
                    Console.WriteLine("Exception: {0}", e.Message);
                    return;

                }
            }
        }
A: 

There should be at least one push application installed on the device. If you uninstall the application and there are no push apps on the device the device does not connect to push in order to preserve the battery.

Shaji
Thanks Shaji for your response. I have tried your suggestion but still I dont get any response from the feedback service.Steps I took:1. Installed the dev version via Xcode. Sent a push. worked fine.2. Installed 2 push notification enabled apps. Some instant messaging app. Received pushes from them sucessfully.3. Delete my app.4. Sent 2 push notifications to my app.5. Been trying the feedback service, but no joy. The bytes return 0.Anything else i can try?Regards
Tee
@Tee have a look at this question for a possible solution. http://stackoverflow.com/questions/1278834
Shaji