0 Replies Latest reply on Nov 13, 2013 10:29 AM by mattbrand

    iOS app crashes when RemoteNotifier subscribes

    mattbrand

      I am attempting to get push notifications working. I am building my app in FlashBuilder 4.6 using Starling 1.4.1 and AIR 3.9.

      I have been referencing these two sources:

      http://help.adobe.com/en_US/air/build/WSd6d4f896b3a8801b7be2f55d138e29d5e40-8000.html

      http://help.adobe.com/en_US/air/build/WSd6d4f896b3a8801b7be2f55d138e29d5e40-8000.htmlhttp://blogs.adobe.com/airodynamics/2012/05/29/push-notifications-support-in-ios/

      My app keeps crashing on the subscribe call. I have tried deploying to both an iPad4 and an iPhone4, both running iOS7. It crashes on both.

      My code:

      if (RemoteNotifier.supportedNotificationStyles.length > 0)
      {
          preferredStyles
      = new Vector.<String>();
          preferredStyles
      .push(NotificationStyle.ALERT, NotificationStyle.BADGE, NotificationStyle.SOUND);

          subscribeOptions
      = new RemoteNotifierSubscribeOptions();
          subscribeOptions
      .notificationStyles = preferredStyles;

          remoteNot
      = new RemoteNotifier();
          remoteNot
      .addEventListener(RemoteNotificationEvent.TOKEN, tokenHandler);
          remoteNot
      .addEventListener(RemoteNotificationEvent.NOTIFICATION, notificationHandler);
          remoteNot
      .addEventListener(StatusEvent.STATUS, statusHandler);

          remoteNot
      .subscribe(subscribeOptions);
      }


      The command that crashes the app is remoteNot.subscribe. I have tried putting that command in an activate event handler, and it still crashes (not right away, but when I minimize the app and then restore it). None of the remoteNot event handlers ever get called.

      The app runs fine if I comment out that one line of code.

      Anyone have any ideas or tips?