So here I was, testing push notifications on various devices. I plugged in the old iPod touch (which had been out of juice for a few weeks) and ran the app on it in the Xcode debugger.
But something odd was happening. After my appDelegate called registerForRemoteNotificationTypes:
, I was not getting any response callback at all; neither application: didRegisterForRemoteNotificationsWithDeviceToken:
nor application: didFailToRegisterForRemoteNotificationsWithError:
was being called. That’s right, not even an error callback.
Meanwhile, the code was working fine on my iPhone. A few quick Google searches didn’t turn up anything very useful, except for one suggestion to try installing another app from the app store that used push notifications. I figured that would at least be good for a test.
I launched the App Store app, and tried to download Boxcar. I immediately got this alert:
Aha! Of course. Because the iPod touch’s battery had died, its clock had been reset to 1969, and thus could not make an SSL connection to Apple’s servers. Setting the iPod’s clock to the correct data and time fixed the issue: push notifications were now working correctly.
I just thought I’d document this in the off chance that it might help someone else :)