title: CoreBluetooth state preservation issues
body: <p><a href="http://www.raywenderlich.com/52080/introduction-core-bluetooth-building-heart-rate-monitor" rel="nofollow">The app is a simple heart rate monitor from this link</a> and right now I'm just playing around with Core bluetooth and I'm trying to "perform long-term actions in the background" which involves  <a href="https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW7" rel="nofollow">Adding Support for State Preservation and Restoration</a></p>
  
  <p>The first thing to do change the info.plist file then I "Opt In to State Preservation and Restoration" by replacing </p>
  
  <pre><code>CBCentralManager *centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
  </code></pre>
  
  <p>in my MainViewController.m with </p>
  
  <pre><code>CBCentralManager *centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:@{CBCentralManagerOptionRestoreIdentifierKey:@"myCentralManager"}];
  </code></pre>
  
  <p>The second step involves "Reinstantiate any central or peripheral manager objects after your app is relaunched by the system". </p>
  
  <p>I do this by adding first adding this property into MainViewController.m</p>
  
  <pre><code>@property (weak,nonatomic) id &lt;CBCentralManagerDelegate&gt; delegate;
  </code></pre>
  
  <p>Then in appDelegate.m</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
  
      self.centralManager = [[CBCentralManager alloc] initWithDelegate:MainVC.delegate  queue:nil options:@{CBCentralManagerOptionRestoreIdentifierKey:@“myCentralManager”}];
      return YES;
  }
  </code></pre>
  
  <p>Next step is to "Implement the Appropriate Restoration Delegate Method"</p>
  
  <pre><code>-(void)centralManager:(CBCentralManager *)central willRestoreState:(NSDictionary *)dict {
      NSLog(@"willRestoreState called");
  ///        self.myPeripheral = [dict[CBCentralManagerRestoredStatePeripheralsKey]     
  ///firstItem];
  ///        self.myPeripheral.delegate = self;
  }
  </code></pre>
  
  <p>I'm getting the error</p>
  
  <pre><code>*** Assertion failure in -[CBCentralManager initWithDelegate:queue:options:],               /SourceCache/CoreBluetooth/CoreBluetooth-242.1/CBCentralManager.m:194
  2015-05-22 00:42:16.049 HeartMonitor[9694:793663] *** Terminating app due to     uncaught exception 'NSInternalInconsistencyException', reason: '&lt;CBCentralManager:   0x17009e050&gt; has provided a restore identifier but the delegate doesn't implement   the centralManager:willRestoreState: method'
  </code></pre>
  
  <p>Thanks</p>