2012年10月20日 星期六

Apple Push Notification Services (APNS)

Apple Push Notification Services Tutorial: Part 1/2
Apple Push Notification Services Tutorial: Part 2/2

 1.產生Certificate Signing Request (CSR)
Keychain Access -> Certificate Assistant-> Request a Certificate from a Certificate Authority….
儲存成 pushtest.certSigningRequest

左下方 Keys -> 選擇最下方pushtest的private key按滑鼠右鍵 -> Export "pushtest"...
儲存成pushtestkey.p12

2.建立App ID 以及 SSL certificate
Bundle Identifier 必須與 Xcode 一致
上傳 pushtest.certSigningRequest 產生 aps_development.cer 以及 aps_production.cer

3.產生 pem 檔
到目前為止你應該有以下檔案,並把它們放在 Documents/pushtest 底下
pushtest.certSigningRequest
pushtestkey.p12
aps_development.cer
aps_production.cer
開啟 Terminal 切換到 Documents/pushtest 底下

openssl x509 -in aps_development.cer -inform der     -out pushtestcert.pem

openssl pkcs12 -nocerts -out pushtestkey.pem -in pushtestkey.p12

cat pushtestcert.pem pushtestkey.pem > ck.pem

telnet gateway.sandbox.push.apple.com 2195

openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert pushtestcert.pem -key pushtestkey.pem

4.建立 Provisioning Profile
選擇 push test 的 App ID
下載 pushtest_development.mobileprovision 並匯入 Xcode



沒有留言:

張貼留言