ios9:检测设备是否收到通知

时间:2016-11-30 14:41:18

标签: ios objective-c push-notification remote-notifications

目标:我想在设备上收到通知时使用通知数据。 我实现了方法

(function (global) {
  System.config({
    paths: {
      // paths serve as alias
     'npm:': 'node_modules/',
      moment: 'node_modules/moment/moment.js'     
    },

    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      app: 'app',
      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
      // other libraries
      'rxjs': 'npm:rxjs',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
      'ng2-bootstrap': 'npm:ng2-bootstrap',
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.js',
        defaultExtension: 'js'
      },
      rxjs: {
        defaultExtension: 'js'
      },
      'angular-in-memory-web-api': {
        main: './index.js',
        defaultExtension: 'js'
      },
      'ng2-bootstrap': {
        main: './ng2-bootstrap.js',
        defaultExtension: 'js'
      }
    }
  });


  esriSystem.register(
    // array of Esri module names to load and then register with SystemJS
    [
      //"dojo/on",
      'esri/Map',
       'esri/core/Collection',
      'esri/layers/FeatureLayer',
      'esri/renderers/SimpleRenderer',
      'esri/symbols/Symbol',
      'esri/symbols/SimpleMarkerSymbol',
      'esri/symbols/SimpleLineSymbol',
      'esri/Graphic',
      'esri/Color',
      'esri/geometry/Polygon',
      'esri/geometry/Polyline',
      'esri/geometry/Point',
      'esri/views/View',
      'esri/views/MapView',
      "esri/views/SceneView",
      'esri/widgets/Widget',
      'esri/widgets/BasemapToggle',
      'esri/request'
    ],
    // optional callback function
    function () {
      // then bootstrap application
      System.import('app/main').then(null, console.error.bind(console));
    });

我可以在通知上看到可操作的按钮,当点击一个按钮时,我就知道已经采取了行动。

同时实施

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

(void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler

(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken

但收到通知后,此方法不会执行。

ios9及以下是否有任何限制?

0 个答案:

没有答案
相关问题