Apple Push Notifications - When Registering for Notifications no Callbacks are received at all - iphone

I've gone through all the steps as specified, am using a dev certificate with APN enabled and am calling registerForRemoteNotificationTypes: with the right flags in my app delegate.
Still, neither application:didRegisterForRemoteNotificationsWithDeviceToken: nor application:didFailToRegisterForRemoteNotificationsWithError: are being called. It looks like the registration request just gets stuck in transit.
What am I doing wrong?

This sounds silly, but it's bit me in the past: double-check your capitalization and parameter types. If a delegate method declaration isn't spot on your method won't get called, and you won't get any kind of warning.
Your best bet is to copy and paste the prototype from Apple's documentation.

Try your App on another device. If it works there...
I have the same Problem with one iPhone 3G (no jailbreak, no unlock). It somply dos not work with that phone. I tried updating to a newer iPhone OS. I tried a factory reset. It does show the confirmationscreen and it records the answer in the Settings. But neither application:didFailToRegisterForRemoteNotificationsWithError nor application:didRegisterForRemoteNotificationsWithDeviceToken are ever called.
The same App works on all other tested devices (ipods, iphones). This iPhone 3G does also not receive PNs for other apps.
PNs also did not work for one Jailbroken Classic iPhone.
It might be that your device is simply not behaving correctly. Try a different device.

I had this problem too and it was because of bad certificates, app id, provision profile...
Make sure that:
1, Correct certificates are installed on client AND server
2, Make sure that you have selected correct provision profile in your project settings. REMEMBER App ID in your provision profile has to be specific(not ending with *) and last part of this App ID has to match name of your application exactly and it is case sensitive. so iv your app is called myApp then your app id has to be SOMENUMBERScom.yourcompany.myApp
Just an idea...

I had the same problem and solved it by disconnecting from the cellular network. Seems to be some problem when both wireless and 3G are on concurrently.

I found out that PUSH notifications require port 5223 open in your network (if you are using WIFI), or otherwise, a cellular data connection.
I encountered the same problem in my home network, and had to open the port manually in the wireless router.

Related

Apple Reachability sample doesn't work in background mode

I've seen that there's a lot of entries in the forum about Apple's Reachability Class, but I haven't seen a solution for this one.
I'm developing a VoIP app that needs to detect connectivity changes in background mode and real time. SCNetworkReachability API should do the job, but I'm facing some problems...
First of all, I've downloaded Reachability sample code from Apple (v2.2) but I haven't been able to make it work in background mode. It works great if I launch the app on the simulator and plug/unplug de network cable. But if I try on the device, launching the app and then going to background mode for enable/disable wifi, the app isn't been notified at all.
I've set "Application does not run in background = NO" and "Required background modes=App provides Voice over IP services" in the info.plist without success. The Donoho version of this sample code has the same problem.
Second one... I've integrated the Reachability sample code on the VoIP app that I'm developing (Linphone based) and... the connectivity changes are detected on background mode...!!!
Nevertheless, it doesn't work well always:
if I launch the app with wifi on, all the following reachability changes, even in background mode, are detected -> OK
but if I launch the app without wifi off, the app doesn't detect the wifi recovery... -> KO
So, the questions are:
how can I make Apple Reachability sample works in background mode?
and... when Reachability class looks to be working on background mode, why it only works really when the first reachability check finds connection available?
I'm running the apps on iPhone4 with iOS 5.1.1 (maybe some problem with iOS version > 5.0...??)
I've checked too the pointed solution on this thread, but last version of Reachability sample is already taking care of that retain/release issues...
Thanks in advance
I've been around this issue for some days, and finally the problem looks to be closely related with the NSStreamNetworkServiceTypeVoIp connection mode,
Looks like a suspended app only could listen to connectivity changes once it has established an active NSStreamNetworkServiceTypeVoIp connection with the remote server.
That explains why Reachability sample is not responding to the connectivity changes in background mode (no NSStreamNetworkServiceTypeVoIp connection within the app) and why the voip app neither responds if wifi's off on first launch...
So, looks like some kind of workaround will be needed for this one...
This Reachability may help you which also comes with sample code.This notifies you whenever your internet goes down or comes up instantly.

Push Notifcation Woes with Titanium & XCode

I am using Titanium 2.0.2 to create an iPhone app which must, amongst other things, be able to receive push notifications. I have done the following
a. Created the AppID in my Apple Developer account
b. Configured the AppID for Push
c. Created a new provisioning profile using the newly created AppID
d. For good measure edited that profile - given that I have heard reports that the first time round it does not pick up the AppID Push info correctly
Armed with all of that I have proceeded to register my app for Push using Ti.Network.registerForPUshNotifications and coded the success, error and callback methods. I have closely followed the example in the Titanium Kitchen Sink demo.
Having done all this I had fully expected one of the following outcomes
Registration succeeds and I get the alert message I have stuck in the Success callback.
Registration fails and I get the alert message in my Error callback
Much to my surprise nothing happens at all - it is like the registerForPushNotifications call goes out into the ether and is well...gone
To be doubly sure I created a simple XCode project following the excellent tutorial at http://maniacdev.com/2011/05/tutorial-ios-push-notification-services-for-beginners/. The app registers with APNS and I trap the assigned remoteDeviceUUID using my iPad and http://itunes.apple.com/us/app/consolelog/id415116252?mt=8. I have then adapted the simplepush.php script from ManicDev and run it off my local WAMP server. It gets through to APNS and deposits my very first PUSH message. But it never arrives on my iPad!
For the sake of completeness I should mention that I am getting a development build onto my iPad with the help of TestFlightApp.
So what am I doing wrong here?
a. Why does Titanium simply not want to do anything in response to RegisterForPushNotifications?
b. Wny does my sample XCode app never get the Push notification?
I would hugely appreciate any help on this one.
A note for anyone running into this post. Beware of testing Push notifications on your iPad behind a WiFi firewall router. Most routers block access to the port used by APNS. I spent way too much time trying to find a "bug" in my code only to discover that there wasn't one. Putting the device in the DMZ on your router might help but is not reliable - at least not with my Sitecom router.
The adhoc builds that Test Flight uses are "Production" in terms of the push notifications not development ones so mostly likely your server needs to be configured with the Production APNS server keys to get it to work.

How can i Open Serial Port of Dock connector in iOS 5.0.1

I can successfully open the serial port of iPhone/iPad in lower version than iOs 5. with the use of
open("/dev/tty.iap", O_RDWR | O_NOCTTY | O_ASYNC))
but i got error "Operation not permitted" in iOS 5 .
(I used the Serial Programming for communicating accessory and iPhone)
Is there any one have idea about this.
Thanks.
Since it also doesn't work for me I think Apple blocked serial access on iOS5+. Stefan Esser (#i0n1c on twitter) just had a talk about this at a security conference. I'm waiting for the slides so then we know what happened to serial
Not sure if you got this working, but from what I have read you can not access the iPhone's serial port for communication while your app is in the sandbox. By sandbox, I mean when you click "run" in Xcode and transfer your app to your iDevice the app lives in a sandbox environment. This environment prohibits your app from accessing things such /dev/tty.iap the serial port within the dock connector. One solution I have read is to copy your app /Applications/which is a link to the location /var/stash/Applications.XXXXXX/ which should take your app out the sandbox environment, and give it access to /dev/tty.iap Let me know if this works for you as this is something I am eventually going to have to do with the app I am developing.
I got the same error and was able to solve it by putting the app in the directory where Cydia apps go rather than where Xcode automatically puts it (Found this hint in the second link in this related/identical post).

Inconsistency in receiving push notification

I found some weird behavior in push notification. My iPod app receives push notifications till last week with no issues. Then I found that my app is not receiving push notifications, and I changed the certificates and it worked fine, and after 2 days its not working. And I repeated the same process and same kinda problem. I was wondering why this happens?
NOTE I am using my own java based server to send push notification. I am sure that my certification are not expired. At the time of this problem the badge id is also not visible with my application icon.??
Thanks in advance.
Ensure a few things
You are using the correct combination of production or dev pem and the APNS or sandbox server URL
Check the Feedback services to ensure whether you are getting any errors
I faced similar issues with my 3GS running OS 4.1 last week. It started working after I restarted my device. Try doing that and see if it works.
Please make sure to update the device token in the database of you provider. I guess some updates in your iOS/certificates may changed your device token. Just make a test around that.
Try lostInTransit's solution and also check for your internet connectivity. I also faced this issue with my iPod sometimes the push notifications not come in my iPod. Try this -
Install facebook iPhone app on your device.
Send a test push notification from your server.
If the notification does not come then do something with facebook which should generate the notification.
If the notification from facebook does not come it means its related to your net connectivity.And your code is perfect.
Sometimes I see that when my iPod is on DHCP it does not receive the notification but when I assign it a static network (dedicated IP) it works fine.

Apple Push Notification Service - notification messages aren't sent to iphone device

I constructed provider code with using C# and it was able to send notification messages to iphone devices successfully. But since yesterday, it hasn't worked. Also it seems to connect APNS successfully and send notification message. Unfortunately, no notification message is received by iphone device. I controlled internet connection and device token of iphone device. What else can I do? Thanks in advance...
I dont have enough rep to comment on the question so typing out answer - Please add more details and I will edit my answer.
Is this in a developer / testing environment and are you using an ad hoc profile to install the application on the iphone devices?
Did you check if the device token has changed and that you are using the new/ correct token in the C# code?
Do provide more details of your problem.
Crazywood, I don't have a solid answer for you but I can tell you I'm in the same boat as you.
There are times when all my notifications go through and times when none of them seem to.
One guess is that not all notifications are sent. According to the docs, in production remote notifications are not guaranteed to be received by the client. My guess is that this is also the case for the sandbox.
-------- EDIT ------
I went through the trouble shooting list (http://developer.apple.com/library/ios/#technotes/tn2010/tn2265.html) and came across this:
The device may have lost its persistent connection to the push service and can't reconnect. Try quitting the app and relaunching it to see if registration completes the next time. (On iOS 4 and later on devices that support multitasking, you will need to force quit the app from the recents list.) If the registration does not complete, iOS has been unable to re-establish the persistent connection. You can troubleshoot this as described in the previous two sections.
I restarted the app and it made no difference. Then I rebooted my phone. That seemed to do the trick.