У меня есть приложение Cordova (версия 9), которое использует phonegap-plugin-push (v2.3.0) на cordova-ios (v4.5.1), которое не регистрируется для уведомлений при запуске на устройстве iOS (iPad mini iOS9.3.5). Я использую Xcode (версия 8) в MacOSX Sierra. На вкладке Возможности проекта xcode включены push-уведомления, проект строится без ошибок, а в конфигурации идентификатора приложения включены push-уведомления с действующим сертификатом. Кроме того, он не показывает наличие доступа к уведомлениям в настройках приложения на устройстве iOS и не запрашивает доступ при запуске.
Как мне определить причину проблемы с регистрацией? Имеет ли какое-либо отношение к устройству, с которого я его запускаю? Я пропускаю звонок, который запрашивает доступ к уведомлению в коде? Я пропускаю процедуру ошибки, которая может дать мне знать, в чем проблема?
Действия, которые я предпринял:
Удаление / переустановка cordova
Удаление / переустановка ios
Деинсталлировано / переустановлено phonegap-plugin-push
Изменен порядок их добавления
Исправлены многочисленные ошибки сборки, из-за которых приложение не собиралось или не подписывалось.
Помещало приложение вотладчик и пошагово прошел код Javascript, в котором находится регистр.
Экспортированный профиль обеспечения из сборки выпуска и проверен на наличие прав.
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 ()
{
console.log( 'mobile-rewards: bindEvents() called' )
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 ()
{
const push = PushNotification.init(
{
android:
{
},
browser:
{
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
},
ios:
{
alert: "true",
badge: "true",
sound: "true"
},
windows: {}
});
// e.message
push.on('error', function(e)
{
console.log(e.message);
});
push.on('registration', function(deviceInfo)
{
console.log("device info - "+deviceInfo.registrationType+":"+deviceInfo.registrationId);
});
push.on('notification', function(data)
{
console.log(data.message);
});
},
};
// initialize the app.
app.initialize();
I expected the plugin to register successfully but it doesn't appear to have done so. There is no error present coming from the error handler and the plugin appears to function normally. The debug output log from the plugin shows progress through the entire PushPlugin.m code for the init. The exported app shows the aps-environment provision within it for production. However, the application neither returns a registration ID, prompts for notification access, nor shows up as even needing these privileges in the settings.