Skip to content

Instantly share code, notes, and snippets.

@soyoes
Last active March 31, 2016 02:42
Show Gist options
  • Save soyoes/eabc180e072b92d239f1 to your computer and use it in GitHub Desktop.
Save soyoes/eabc180e072b92d239f1 to your computer and use it in GitHub Desktop.
apple push
1: keychain->[Keychain access]->[Certificates Assistants]->[Request ...]->{email:YOURs, Common Name:"APP_NAME PUSH"}->[save to disk] (f1.certSigningRequest)
* DON'T forget to set [Common Name]="APP_NAME PUSH", or you won't find it later
* DON'T through away f1.certSigningRequest, it can be used while renew a year later.
2: dev center->certificates->[Identifiers]->App IDs-> [+] button
-> check enable Push -> [Create Certificate...] -> [continue] -> upload the file of #1 (f1.certSigningRequest) -> [Generate] -> [Download] => you got a "aps_development.cer" file (f2.cer)
* DON'T forget to install f2.cer by double click!
3: keychain->certificates->[your app buldle id]->right click->export ... ->save as f3.p12
* YOU may have to specify a password of at least 4 bit !
4: make PEM file with your f3.p12, u will get cert.pem (a cert pem file)
```Bash
openssl pkcs12 -in f3.p12 -out cert.pem -nodes -clcerts
```
5: create provisining file
dev center -> Provisioning Profiles -> + button
-> choose [Development > iOS App Development] for dev or [Distribution > App Store] for product version
download and click the file
6: in your xcode -> Build Settings -> Provisining Profile : select the profile of #5 -> run
7: test connection
```Bash
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert F4.pem -key F5.pem
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment