- 生成Certificate Signing Request (CSR)
打开keychain access 如下图所示:
按要求输入相应的信息即可。把证书保存到本地
2.导出私有密钥
打开keychain access 通过查询功能(通过生成证书的common name查询)找到私有密钥,导出。如下图所示:
注意保存的时候会提示输入密码,这个密码要记住哦,后面有用。导出命名为:PushOAKey.p12
3.使用付费的苹果账号登录https://developer.apple.com。进入 iOS Provisioning Portal,创建一个app id.如下图所示:
4.创建完APPID后配置推送,如下图所示:
我这里是配置过了,如果没有配置就会有个configurable,点击以后进行配置,如下图所示:
选择继续,如下图所示:
在这里选择我们第一步生成的CertificateSigningRequest.certSigningRequest证书即可,生成完成,下载.cer后缀名的文件到本地,命名为:aps_development.cer
5.到目前为止,我们已经生成了三个证书
如下所示:PushChat.certSigningRequest PushOAKey.p12 aps_development.cer
6.生成java,.net端连接apns的证书.这里使用openssl。操作步骤如下所示:
使用OpenSSL
1、将aps_development.cer转换成 aps_developer_identity.pem格式。
openssl x509 -in aps_development.cer -inform DER -out aps_developer_identity.pem -outform PEM
2、将p12格式的私钥转换成pem,密码都设置为:abc123。
openssl pkcs12 -nocerts -out Push_oa.pem -in PushOAKey.p12
3、用certificate和the key 创建PKCS#12格式的文件。
openssl pkcs12 -export -in aps_developer_identity.pem -inkey Push_oa.pem -certfile CertificateSigningRequest.certSigningRequest -name aps_developer_identity -out aps_developer_identity.p12
这样我们就得到了在应用程序中使用的证书文件:aps_developer_identity.p12。
注:苹果的消息推送服务器地址:
如下图:
To develop and deploy the provider side of a client/server application, you must get SSL certificates from the appropriate Dev Center. Each certificate is limited to a single application, identified by its bundle ID. Each certificate is also limited to one of two development environments, each with its own assigned IP address:
-
Sandbox: The sandbox environment is used for initial development and testing of the provider application. It provides the same set of services as the production environment, although with a smaller number of server units. The sandbox environment also acts a virtual device, enabling simulated end-to-end testing.
You access the sandbox environment at
gateway.sandbox.push.apple.com
, outbound TCP port 2195. -
Production: Use the production environment when building the production version of the provider application. Applications using the production environment must meet Apple’s reliability requirements.
You access the production environment at
gateway.push.apple.com
, outbound TCP port 2195.
You must get separate certificates for the sandbox (development) environment and the production environment. The certificates are associated with an identifier of the application that is the recipient of push notifications; this identifier includes the application’s bundle ID. When you create a provisioning profile for one of the environments, the requisite entitlements are automatically added to the profile, including the entitlement specific to push notifications, <aps-environment>
. The two provisioning profiles are called Development and Distribution. The Distribution provisioning profile is a requirement for submitting your application to the App Store.
OS X Note: The entitlement for the OS X provisioning profile is com.apple.developer.aps-environment
, which scopes it to the platform.
You can determine in Xcode which environment you are in by the selection of a code-signing identity. If you see an “iPhone Developer: Firstname Lastname” certificate/provisioning profile pair, you are in the sandbox environment. If you see an “iPhone Distribution: Companyname” certificate/provisioning profile pair, you are in the production environment. It is a good idea to create a Distribution release configuration in Xcode to help you further differentiate the environments.
Although an SSL certificate is not put into a provisioning profile, the <aps-environment>
is added to the profile because of the association of the certificate and a particular application ID. As a result this entitlement is built into the application, which enables it to receive push notifications.
相关推荐
iOS 消息推送(iOS 工程源码),简单的实现了iOS的消息推送功能。
C#下IOS消息推送实例,framework4.5版本,有简单的示例
ios 消息推送 java后端demo(包括测试代码所需要的jar包)
IOS消息推送机制 ios消息推送主要主流有两种方式,一种是基于javaapns.jar和javaPNS.jar的开源的消息推送,javaPNS.jar支持多线程。
本程序为测试ios推送消息程序。 生成推送证书后,添加到本程序根目录下,并配置JdSoft.Apns.Test.exe.config文件,就可以向指定设备推送消息。 可一作为验证证书是否生成正确。 ///证书名称 ...
使用notnoop进行IOS消息推送,一个样例
ios消息推送源码,包括php服务端,做apns的朋友可以直接使用。xcode6.1 做的一个demo
IOS消息推送服务后台服务器 ,源代码加实例
iOS 消息推送 苹果官方的消息推送方式 , APNS 需要证书的 客户端代码
iOS 消息推送服务器(OS X工程源码),只需填写你的deviceToken和.cer,并添加.cer资源到工程,然后运行即可发送推送消息。
IOS 消息推送 java服务端和客户端源码
IOS消息推送之APNS - iOS知识库1
关于IOS_APNS推送消息(iphone端+服务端)。关于IOS_APNS推送消息(iphone端+服务端)。
import javapns.data.Device; import javapns.data.PayLoad; import org.apache.log4j.Logger; import org.apache.commons.lang.StringUtils; import javapns.back.SSLConnectionHelper; import javapns.back....
IOS Java实现消息推送(APNS),包含bcprov-jdk15on-149.jar、javapns-jdk16-163.jar
完整的消息推送的架包,和实例代码!每一步都有注释,方便解读!
以.net作为服务器开发对ios端进行消息推送的服务机制。其中有server和test。再按照说明把密钥和p12文件在Jdsoft.Apple.Apns.Notifications中做下调整。
此文档描述了IOS推送的实现原理、详细的证书制作及核心代码实现(带图)!
APNS(Apple Push Notification Service)苹果推送通知服务。该技术由苹果公司提供的APNS服务。工作原理:首先,APNS会对用户进行物理连接认证,和设备令牌认证(简言之就是苹果的服务器检查设备里的证书已确定其为...