iPhoneDev
iPhoneDev

Reputation: 421

Push notification not working under Ad-Hoc profile - Tried (Almost) everything

I successfully got the token back from APNs when using development profile. When moved to Ad Hoc, I never got a token back from APNs, hence I couldn't send it to our notification server. Tried anything after reading all the post on Stackoverflow and official documentation (i.e. recreated profiles, certificates, etc.) Now, I tried to use

codesign -dvvvv --entitlements - MyApp.app

command to see how I signed the app and I received the following

<dict>
    <key>application-identifier</key>
    <string>XXXXXXX.com.company.MyApp</string>
    <key>aps-environment</key>
    <string>production</string>
    <key>get-task-allow</key>
    <false/>
    <key>keychain-access-groups</key>
    <array>
        <string>XXXXXXX.com.company.MyApp</string>
    </array>
</dict>

Is this an Ad Hoc code sign? Shouldn't it have the list of UDID added to the profile? Any other idea of what would it be? Thanks!

Upvotes: 2

Views: 6658

Answers (4)

Moosa Baloch
Moosa Baloch

Reputation: 1175

Having same problem If any body of you didnt notice, change the push url on your server code APNs uses production profile for AdHoc and for production you must have to remove the sandbox in url as mention below

if ($production) {
    $gateway = 'gateway.push.apple.com:2195';
} else { 
    $gateway = 'gateway.sandbox.push.apple.com:2195';
}

Ref: http://codular.com/sending-ios-push-notifications-with-php

Upvotes: 1

alexandrubarbat
alexandrubarbat

Reputation: 197

A.member center
0. certificate 'iOS Distribution'
1. AppID with push notification enabled for distribution
2. certificate 'APNs Production iOS'
3. AdHoc Distribution Provisioning Profile (unique per AppID)
4. download certificate 'APN production iOS' and click on file to be added to Keychain Access

B.xcode 6.1.1
1.configure project using AppId
2. product/archive/export/Save for Ad Hoc Development -- signing identity should be 'iOS -Distribution' and 'Provisioning Profile' should be AdHoc Distribution Profile
3. export ipa file

C.itunes 12.0.1.26
1.add ipa file into itunes/Applications
2.connect device to itunes itunes/device(itunes up left corner)/Settings/Apps/ change app to 'will install'
3.synchronize
4.start application and obtain the push notification token

D.KeyChain Access -export the key from certificate 'APN production iOS' into .p12 -- > app_prod_apn_key.p12 using password 123456

E.JavaPNS 2.2 (or other tool -- use production apple server)
-run the following command: java -cp JavaPNS_2.2.jar:log4j-1.2.17.jar:bcprov-jdk15on-151.jar javapns.test.NotificationTest app_prod_apn_key.p12 123456 xxxxxxxx75556f8b56da29082da5f0f05d3cac1166fc84b7efd411b7fxxxxxxx production complex

Upvotes: 2

Nick
Nick

Reputation: 2613

Make sure that your Production Push certificate matches the app IDs present in your adhoc build. If you have a .PEM file, open it up and make sure that it mentions "Apple Production IOS Push Services" at the top as is followed by the exact same bundle identifier as your adhoc build.

Upvotes: 0

Andrea
Andrea

Reputation: 26385

For ad hoc you should use release certificate with production APN. If it still doesn't work try to check if you can connect to production APN ports and range of ips. "Apple Technical note"

Upvotes: 0

Related Questions