Hi,
i need to show Local Notifications , on Android (simulator, device) and iOS 9.3 simulator everything works fine.
On iOS 10 (device and simulator , iOS 10.2 and 10.3) the notifications never appear.
I followed the ionic native documentations and various online tutorials, but the result remains the same.
When I open the App on iOS, I get the permission request to show notifications, but they never appear.
This is my code (just a small demo project):
import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';
import { LocalNotifications } from '@ionic-native/local-notifications';
@Component({
selector: 'page-home',
templateUrl: 'home.html',
providers : [LocalNotifications]
})
export class HomePage {
public localNotifications : any;
constructor(public platform: Platform, public navCtrl: NavController, private localNotifications1: LocalNotifications) {
this.localNotifications = localNotifications1;
this.platform.ready().then(() => {
console.log("-----------------in view did load-------------------");
this.localNotifications.hasPermission().then(function(granted) {
if (!granted) {
console.log("not granted!");
this.localNotifications.registerPermission();
}
});
this.localNotifications.on("click", (notification, state) => {
console.log("clicked on notification");
});
console.log("scheduling notification");
this.localNotifications.schedule({
id: 1,
title:'Demo',
text: "LocalNotification",
at: new Date(new Date().getTime() + 5 * 1000),
data: { secret: 'key' }
});
});
}
ionViewDidLoad(){
}
}
This is a real dealbreaker, I cannot release the App like this.
ionic info
Cordova CLI: 6.5.0
Ionic Framework Version: 3.2.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v7.7.3
Xcode version: Xcode 8.3.2 Build version 8E2002
package.json
{
"name": "ionic-hello-world",
"version": "0.0.0",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.1.0",
"@angular/compiler": "4.1.0",
"@angular/compiler-cli": "4.1.0",
"@angular/core": "4.1.0",
"@angular/forms": "4.1.0",
"@angular/http": "4.1.0",
"@angular/platform-browser": "4.1.0",
"@angular/platform-browser-dynamic": "4.1.0",
"@ionic-native/core": "3.7.0",
"@ionic-native/local-notifications": "^3.8.0",
"@ionic-native/splash-screen": "3.7.0",
"@ionic-native/status-bar": "3.7.0",
"@ionic/storage": "2.0.1",
"ionic-angular": "3.2.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.10"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.7",
"typescript": "2.2.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "localDemo: An Ionic project"
}
Any ideas, help, suggestions?
What should I try?