잠시 동안 iOS에서 푸시 플러그인 (https://github.com/phonegap/phonegap-plugin-push)이 작동하는 데 어려움을 겪었습니다 (iOS 개발에 대해 아무것도 모릅니다). 그것은 장치를 올바르게 등록하는 것,하지만 내가 푸시 워치를 통해 알림을 보낼 때 그것은 애플없이 문제없이 보내지 만 나는 (안드로이드에 대한 매력처럼 작동) 아무것도받지 못합니다.Phonegap 플러그인 푸시 장치가 기기를 등록하지만 알림을받지 못합니다.
Android에서 작동하며 Apple에 알림을 보낼 수 있다는 사실은 문제가 인증서와 관련 있다고 생각하게 만듭니다. 앱 ID를 생성하고 푸시 알림을 사용하고 제작 및 개발 (둘 다 작동하지 않음) 및 개발 용 프로비저닝 프로필에 대한 푸시 인증서를 만들었습니다.
Xcode에서는 preferences/agent/download all에서 프로비저닝 프로파일을 다운로드했는데 (이 부분이 엉망이라고 생각합니다) 자동 빌드 설정을 사용하여 문제없이 응용 프로그램을 빌드 할 수 있습니다. 내 iPhone에서 응용 프로그램을 실행할 때 장치 토큰이 생기므로 장치를 등록합니다. 여기
내하는 index.js (I 푸시 플러그인 템플릿 응용 프로그램을 사용하고 있습니다) 내가 알림을 보낼 수 있습니다처럼var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicitly call 'app.receivedEvent(...);'
onDeviceReady: function() {
console.log('Received Device Ready Event');
console.log('calling setup push');
if(device.platform == "Android"){ //Android
console.log('Android');
var pushNotification = window.plugins.pushNotification;
pushNotification.register(app.successHandler, app.errorHandler, {"senderID":"XXX","ecb":"app.onNotification"});
}
else if(device.platform == "iOS"){ //iOS
console.log('iOS');
var pushNotification = PushNotification.init({
"android": {
"senderID": "XXX"
},
"ios": {
"badge":"true",
"sound":"true",
"alert":"true",
"ecb":"onNotification"
},
"windows": {}
});
}
},
// result contains any message sent from the plugin call
successHandler: function(result) {
console.info('Callback Success! Result = '+result)
},
errorHandler:function(error) {
console.info(error);
},
onNotification:function(e) {
push.on('registration', function(data) {
console.log('registration event: ' + data.registrationId);
var oldRegId = localStorage.getItem('registrationId');
if (oldRegId !== data.registrationId) {
// Save new registration ID
localStorage.setItem('registrationId', data.registrationId);
// Post registrationId to your app server as the value has changed
}
});
push.on('error', function(e) {
console.log("push error = " + e.message);
});
push.on('notification', function(data) {
console.log('notification event');
navigator.notification.alert(
data.message, // message
null, // callback
data.title, // title
'Ok' // buttonName
);
});
}};
그것은 보이지만 APNS 그것을 보낼 위치를 알 수 없습니다 또는이 같은입니다 보내지 만 내 장치는 인증서에 연결되어 있지 않으므로 수신 할 수 없습니다.
미리 감사드립니다.
편집 : 이 튜토리얼의 단계를 따르면 내 문제가 해결 된 것 같습니다. https://blog.serverdensity.com/how-to-build-an-apple-push-notification-provider-server-tutorial/ 내가 생각하는 문제는 키가 당신에게 글쓰기를 요구하는 문구였습니다. 내가 그것을 제거하면 알림이 나타나기 시작했습니다.