ESP 32 and ANCS (Apple notification center service)

I have downloaded the library from James hudson that enables the esp 32 to communicate with ancs. The example given creates a bluetooth connection and is supposed to show you your notifications on your iphone in the serial monitor. I successfully connect the esp 32 to bluetooth and get a connection message on the serial monitor. However any notification that comes through does not show up in the serial monitor and after about 5-10 seconds the Bluetooth connection is lost and I have to reconnect. I have attached the example code below. I am wondering if anyone has any idea what may be causing this.

// @author James Hudson
// @todo license text and header - please see github project for license

// A simple example program to retrieve notifications from your device, and output them to the Serial console.

// Header for this library, from
#include "esp32notifications.h"

// Different hardware presets; uncomment the correct device.
// Or feel free to add your own board layout for your specific hardware.
// See the ESP32 pinout to choose a free GPIO pin on your hardware.


    #define BUTTON_A    25 // left button - use this GPIO pin
    #define BUTTON_B    26 // center button - use this GPIO pin
    #define BUTTON_C    27 // right button - use this GPIO pin
    #error Hardware buttons not supported!

// Example code begins

// Create an interface to the BLE notification library
BLENotifications notifications;

// Holds the incoming call's ID number, or zero if no notification
uint32_t incomingCallNotificationUUID;

// This callback will be called when a Bluetooth LE connection is made or broken.
// You can update the ESP 32's UI or take other action here.
void onBLEStateChanged(BLENotifications::State state) {
  switch(state) {
      case BLENotifications::StateConnected:
          Serial.println("StateConnected - connected to a phone or tablet"); 

      case BLENotifications::StateDisconnected:
          Serial.println("StateDisconnected - disconnected from a phone or tablet"); 
          /* We need to startAdvertising on disconnection, otherwise the ESP 32 will now be invisible.
          IMO it would make sense to put this in the library to happen automatically, but some people in the Espressif forums
          were requesting that they would like manual control over re-advertising.*/

// A notification arrived from the mobile device, ie a social media notification or incoming call.
// parameters:
//  - notification: an Arduino-friendly structure containing notification information. Do not keep a
//                  pointer to this data - it will be destroyed after this function.
//  - rawNotificationData: a pointer to the underlying data. It contains the same information, but is
//                         not beginner-friendly. For advanced use-cases.
void onNotificationArrived(const ArduinoNotification * notification, const Notification * rawNotificationData) {
    Serial.print("Got notification: ");   
    Serial.println(notification->title); // The title, ie name of who sent the message
    Serial.println(notification->message); // The detail, ie "be home for dinner at 7".
    Serial.println(notification->type);  // Which app sent it
    Serial.println(notifications.getNotificationCategoryDescription(notification->category));  // ie "social media"
    Serial.println(notification->categoryCount); // How may other notifications are there from this app (ie badge number)
    if (notification->category == CategoryIDIncomingCall) {
		// If this is an incoming call, store it so that we can later send a user action.
        incomingCallNotificationUUID = notification->uuid;
        Serial.println("--- INCOMING CALL: PRESS A TO ACCEPT, C TO REJECT ---"); 
    else {
        incomingCallNotificationUUID = 0; // Make invalid - no incoming call

// A notification was cleared
void onNotificationRemoved(const ArduinoNotification * notification, const Notification * rawNotificationData) {
     Serial.print("Removed notification: ");   

// Standard Arduino function which is called once when the device first starts up
void setup() {
  // Button configuration. It is usual to have buttons configured as INPUT_PULLUP in the hardware design,
  // but check the details for your specific device 

    while(!Serial) {

    Serial.println("ESP32-ANCS-Notifications Example");

    // Set up the BLENotification library
    notifications.begin("BLEConnection device name");

// Standard Arduino function that is called in an endless loop after setup
void loop() {   
    if (incomingCallNotificationUUID > 0) {
		// Check to see if the user has pressed an action button
	    if (digitalRead(BUTTON_A) == LOW) {
	      Serial.println("Positive action."); 
	    else if (digitalRead(BUTTON_C) == LOW) {
	      Serial.println("Negative action.");