Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用Ionic和Cordova接收推送通知_Cordova_Ionic Framework_Apple Push Notifications_Phonegap Plugins - Fatal编程技术网

无法使用Ionic和Cordova接收推送通知

无法使用Ionic和Cordova接收推送通知,cordova,ionic-framework,apple-push-notifications,phonegap-plugins,Cordova,Ionic Framework,Apple Push Notifications,Phonegap Plugins,我试图用Ionic和Cordova接收推送通知,但我无法定位错误发生的位置,因为一切似乎都在顺利运行 首先,为了调试,我正在启动一个新的、干净的Ionic项目。以下是我的确切命令: ionic start myApp tabs cd myApp ionic platform add ios cordova plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX" 然后我将它添加到$ionicPlatform.ready(fun

我试图用Ionic和Cordova接收推送通知,但我无法定位错误发生的位置,因为一切似乎都在顺利运行

首先,为了调试,我正在启动一个新的、干净的Ionic项目。以下是我的确切命令:

ionic start myApp tabs
cd myApp
ionic platform add ios
cordova plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
然后我将它添加到
$ionicPlatform.ready(function(){…})
块:

var push = PushNotification.init({
    ios: {
        alert: "true",
        badge: "true",
        sound: "true"
    }
  });

push.on('registration', function(data) {
  console.log(data);
});

push.on('notification', function(data) {
  console.log(data);
});

push.on('error', function(e) {
  console.log(e);
});
将其记录到Xcode控制台:

Push Plugin register success: <xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx>
2016-03-26 00:51:49.286 HelloCordova[913:278481] {"registrationId":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
如果您能提供任何建议,说明这并没有达到预期效果,我们将不胜感激

openssl s_client -connect gateway.push.apple.com:2195 -cert cert.pem -key key.pem
CONNECTED(00000003)
depth=1 /C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/C=US/ST=California/L=Cupertino/O=Apple Inc./CN=gateway.push.apple.com
   i:/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
 1 s:/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
   i:/O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Certification Authority (2048)
---
Server certificate
-----BEGIN CERTIFICATE-----
**VERY LONG CERTIFICATE**
-----END 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 is incorporated by 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 and written 2148 bytes
---
New, TLSv1/SSLv3, Cipher is AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : AES256-SHA
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: **MY-MASTER-KEY**
    Key-Arg   : None
    Start Time: 1458949317
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---
closed