ios - Apple push notification not working for distribution/ad hoc testing -


i have been using sandbox push notification while, , working perfectly. after switching distribution, push notification stopped working.

things have checked:

  1. two separate push notification certificates created, 1 development (sandbox) , 1 distribution(production).
  2. device token different sandbox , production.
  3. we use notnoop apns on server side. certificate.p12 created exporting private key under push notification certificate in apple keychain access. certificate not in p12 file.
  4. checked archived package production command

    codesign -d --entitlements :- "payload/yourapp.app"

    and code signing entitlement distribution.

  5. followed apple tn 2265 (https://developer.apple.com/library/ios/technotes/tn2265/_index.html). while using openssl connect apns, connection closed right after handshake (for production). sandbox, there pause after handshake, , more reads & writes.

my command:

> openssl pkcs12 -in cert_prod.p12 -out cert_prod.pem > openssl s_client -connect gateway.push.apple.com:2195 -cert cert_prod.pem -debug -showcerts -cafile "entrust.pem" 

the output (for production):

... server certificate subject=/c=us/st=california/l=cupertino/o=apple inc./cn=gateway.push.apple.com issuer=/c=us/o=entrust, inc./ou=www.entrust.net/rpa incorporated reference/ou=(c) 2009 entrust, inc./cn=entrust certification authority - l1c --- acceptable client certificate ca names /c=us/o=apple inc./ou=apple certification authority/cn=apple root ca /c=us/o=apple inc./ou=apple worldwide developer relations/cn=apple worldwide developer relations certification authority /c=us/o=apple inc./ou=apple certification authority/cn=apple application integration certification authority --- ssl handshake has read 3144 bytes , written 2161 bytes --- new, tlsv1/sslv3, cipher aes256-sha server public key 2048 bit secure renegotiation supported compression: none expansion: none ssl-session:     protocol  : tlsv1     cipher    : aes256-sha     session-id:      session-id-ctx:      master-key: ccce22d7487589d257e547f2693e8aedf86b693e6efe09dcaa7ee74c28812e45506a21b0dc0ed6caaf4395eb2d2899ed     key-arg   : none     start time: 1454828210     timeout   : 300 (sec)     verify return code: 0 (ok) --- read 0x7fa6d3a00060 [0x7fa6d4806600] (5 bytes => 5 (0x5)) 0000 - 15 03 01                                          ... 0005 - <spaces/nuls> read 0x7fa6d3a00060 [0x7fa6d4806605] (32 bytes => 32 (0x20)) 0000 - 8f c6 74 25 a6 40 2b 58-29 bc a4 e0 a7 c9 43 a8   ..t%.@+x).....c. 0010 - a0 93 62 78 6a 73 ed aa-4f 61 0a a4 9e fe a7 9e   ..bxjs..oa...... closed write 0x7fa6d3a00060 [0x7fa6d480b000] (37 bytes => 37 (0x25)) 0000 - 15 03 01 00 20 2c 70 db-af 76 7a 2c 01 70 da 0f   .... ,p..vz,.p.. 0010 - a9 03 da e2 fb 69 f8 09-63 5d 18 85 81 8c 31 63   .....i..c]....1c 0020 - 63 fb 73 cb 48                                    c.s.h 

the output (for sandbox):

... server certificate subject=/c=us/st=california/l=cupertino/o=apple inc./cn=gateway.sandbox.push.apple.com issuer=/c=us/o=entrust, inc./ou=www.entrust.net/rpa incorporated reference/ou=(c) 2009 entrust, inc./cn=entrust certification authority - l1c --- acceptable client certificate ca names /c=us/o=apple inc./ou=apple certification authority/cn=apple root ca /c=us/o=apple inc./ou=apple worldwide developer relations/cn=apple worldwide developer relations certification authority /c=us/o=apple inc./ou=apple certification authority/cn=apple application integration certification authority --- ssl handshake has read 3160 bytes , written 2161 bytes --- new, tlsv1/sslv3, cipher aes256-sha server public key 2048 bit secure renegotiation supported compression: none expansion: none ssl-session:     protocol  : tlsv1     cipher    : aes256-sha     session-id:      session-id-ctx:      master-key: 011b90857bc02d4a9dcb7300f8c9f368905f90ea4bddc0677cd2ea9aab3550cf750f0b57c5af0c72f5bcd991658ac4ac     key-arg   : none     start time: 1454828396     timeout   : 300 (sec)     verify return code: 0 (ok) --- write 0x7f9b19c1aef0 [0x7f9b1a019000] (74 bytes => 74 (0x4a)) 0000 - 17 03 01 00 20 d7 a1 a1-b2 9e ce 49 18 26 0e   .... .......i.&. 0010 - 46 73 f9 dc 7f b2 75 71-f6 bf 51 65 44 0e f1 60   fs....uq..qed..` 0020 - fe 80 2e e2 a6 17 03 01-00 20 f0 dc 70 85 b0   ......... ...p.. 0030 - 82 d0 44 1e 9a b8 fe 59-39 b1 14 0a 9d 7c 0e   ..d....y9.....|. 0040 - ce 09 9b c3 f2 1c dd 28-c7 24                     .......(.$ write 0x7f9b19c1aef0 [0x7f9b1a019000] (74 bytes => 74 (0x4a)) 0000 - 17 03 01 00 20 4c 12 4f-f9 ba 0b e4 80 b3 66 bb   .... l.o......f. 0010 - 93 a7 c9 47 9d 84 36 88-33 c0 80 79 a2 97 c6 95   ...g..6.3..y.... 0020 - 2a 4b 42 c1 bc 17 03 01-00 20 a0 4d 06 fd 84 78   *kb...... .m...x 0030 - 3d b9 12 ad 65 75 b6 1a-01 91 28 86 40 c4 e9 c2   =...eu....(.@... 0040 - 38 91 47 42 c3 1d e3 c7-f9 41                     8.gb.....a write 0x7f9b19c1aef0 [0x7f9b1a019000] (74 bytes => 74 (0x4a)) 0000 - 17 03 01 00 20 35 77 28-ea b0 80 5a ad 9e 99 87   .... 5w(...z.... 0010 - 7d 07 13 14 ff ea a8 48-60 7c 46 f0 59 07 c8 53   }......h`|f.y..s 0020 - 3f 96 55 fc ec 17 03 01-00 20 60 49 00 86 bf 41   ?.u...... `i...a 0030 - 70 70 5c d5 d7 f5 83 4c-8a b3 10 22 bb ad 4c f2   pp\....l..."..l. 0040 - 3e e0 54 db 5d e7 2e bc-cc 9c                     >.t.]..... write 0x7f9b19c1aef0 [0x7f9b1a019000] (74 bytes => 74 (0x4a)) 0000 - 17 03 01 00 20 25 d3 8a-20 a4 4c 3c b6 f7 fe 95   .... %.. .l<.... 0010 - 60 e2 5b 9f fc fd 3d e7-4c 27 cc d0 8e 6c ef 30   `.[...=.l'...l.0 0020 - 56 4a 88 a9 f9 17 03 01-00 20 cc 32 2d d5 e6 ff   vj....... .2-... 0030 - 59 26 14 67 2d 3f 3d 88-d3 3b ea 53 5e 11 72 75   y&.g-?=..;.s^.ru 0040 - a4 c6 0e d8 95 b4 21 e3-5d dd                     ......!.]. write 0x7f9b19c1aef0 [0x7f9b1a019000] (74 bytes => 74 (0x4a)) 0000 - 17 03 01 00 20 8a a0 b6-fd 72 7b f4 f6 ef de 65   .... ....r{....e 0010 - 76 40 6b 67 1d b8 83 c1-92 98 50 9e 0f ac d7 da   v@kg......p..... 0020 - 66 39 9c 39 9f 17 03 01-00 20 70 a4 1d 63 f1 6e   f9.9..... p..c.n 0030 - d6 5a b3 fd f9 7e de de-64 7d 42 0d da 94 59 09   .z...~..d}b...y. 0040 - 93 3f 33 e3 d7 d0 3e 2e-10 e7                     .?3...>... read 0x7f9b19c1aef0 [0x7f9b1a014600] (5 bytes => 5 (0x5)) 0000 - 15 03 01                                          ... 0005 - <spaces/nuls> read 0x7f9b19c1aef0 [0x7f9b1a014605] (32 bytes => 32 (0x20)) 0000 - 60 b6 57 1c 8a 8e e9 f0-59 b5 27 73 f5 ba de b1   `.w.....y.'s.... 0010 - 7a ef d7 ab 79 23 0a ea-b2 13 c9 ca 98 e5 c3 36   z...y#.........6 closed write 0x7f9b19c1aef0 [0x7f9b1a019000] (37 bytes => 37 (0x25)) 0000 - 15 03 01 00 20 f2 6f d0-1b 8d 41 5e 44 df f5 49   .... .o...a^d..i 0010 - 3a 09 6a 11 2b 3b f3 47-1e 70 8d 8d a8 9d 42 45   :.j.+;.g.p....be 0020 - e9 47 18 26 3e                                    .g.&> 

therefore, seems broken link between server , apns. how can know why connection closed?

i suspected wrong on certificate, not find anything. took same steps create sandbox certificates, , worked fine. did miss production?

other related links checked:

  1. apple push notification not working in production
  2. http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
  3. couldn't able connect apns sandbox server

the certificate.p12 in notnoop apns should exported certificate only, without private key. in keychain access, click small arrow next push notification certificate show private key, select certificate (without key), , export .p12 file. updating file on server solved problem. openssl tool smoke test before archiving app , running in ad hoc mode.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -