Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APNS Push Notifications headache; works for development but not production

Hi friends I have been at this for atleast a week. For the life of me i coul'dnt get push notifications working on production, works fine in development.

I have tried, any and every solution that i could find online, nothing worked.

I have regenerated the certificates atleast a 100 times

My entitlements.plist file is good -

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>get-task-allow</key>
    <false/>
    <key>aps-environment</key>
    <string>production</string>
    <key>application-identifier</key>
    <string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
    <key>keychain-access-groups</key>
    <array>
        <string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
    </array>
</dict>
</plist>

Ofcoures when i change the environment and get-task-allow to true, it works fine with gateway.sandbox.push.apple.com. I have also tried with exact bundle name rather than "$(AppIdentifierPrefix)$(CFBundleIdentifier)"

But when i change aps-environment to production and get-task-allow to false(even tried with true) - the device does not recieve any notifications.

i have tried using pushmebaby, writing my ownscript, easyapns - all work with development. I just cant figure out why it breaks in production.

My build settings are good, i have created a duplicate of release configuration, called it ad-hoc and set the codesigning elements to entitlements.plist and the identity to the respective profile.

I am using the same method to generate the certificate files as i have used for generating the developer certificate

openssl pkcs12 -in aps-production-cert.p12 -out aps-production-cert.pem -nodes

When i use codesign -dvvvv --entitlements -Forecast.app i get this - which looks fine.

Executable=/Users/seantan/Documents/Alpha/build/Ad-Hoc-iphoneos/Forecast.app/Forecast
Identifier=com.xxxxxxxx.wforecast
Format=bundle with Mach-O universal (armv6 armv7)
CodeDirectory v=20100 size=2651 flags=0x0(none) hashes=124+5 location=embedded
CDHash=63a3d238db30f8e4fd3c2a545867fe2fe645a981
Signature size=4313
Authority=iPhone Distribution: xxxxxxxx
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=Dec 24, 2010 2:24:08 PM
Info.plist entries=25
Sealed Resources rules=3 files=200
Internal requirements count=1 size=216
??qq?<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>application-identifier</key>
    <string>SYK86VV33F.com.xxxxxx.wforecast</string>
    <key>aps-environment</key>
    <string>production</string>
    <key>get-task-allow</key>
    <true/>
    <key>keychain-access-groups</key>
    <array>
        <string>SYK86VV33F.*</string>
    </array>
</dict>
</plist>

I am totally out of ideas/solutions. Anybody can point me to the right direction?

Before someone suggests, i have tried with gateway.push.apple.com for production and gatetway.sandbox.push.apple.com for development

like image 908
Veeru Avatar asked Dec 24 '10 08:12

Veeru


1 Answers

I had similar problems. Stepping through the instructions described at this Apple developer document helped a me. I had to make several changes, so I can't say exactly which solved the problem. Maybe you're problems differ, but here's hoping something there helps you.

like image 197
Ryan Avatar answered Oct 18 '22 01:10

Ryan