0

I have two views: One central TableView where all the discovered devices appear and one detailView which loads when the user selects to connect to one of the discovered devices.

It works until the following point:

  • Discovering devices
  • Connect to device
  • Read services, characteristics and subscribe to them
  • Values of char's are successfully being read and displayed on the detailView

When I now return from the detailView through the "back"-button the callback-function

 override func viewDidAppear(animated: Bool) {
    if(!firstStart){
        tableView.reloadData()
        println("appeared!")
        discoverDevices()
    }

}

gets called but after that I end in an EXC_BAD_ACCESS. My discoverDevices() function is the following:

func discoverDevices() {
    println("discovering devices......")
    centralManager.scanForPeripheralsWithServices(nil, options: nil)
}

There seems to be some error in "centralManager.scanForPeripheralsWithServices(nil, options: nil)" - but only after the callback. Right from the start everything is fine. Do I have to set some delegate somewhere? I can't figure out anything with the "EXC_BAD_ACCESS"-Error.

Do I have to re-initialize the centralManager? Do I have to restart it?

Thanks for any help in advance.

Kind regards, Stevil

Stevil
  • 1
  • 1

1 Answers1

0

I found it out by myself. The problem was the peripheral.delegate that I had to set again in the main tableView. Now all is running smooth.

Maybe this helps other newbies.

Stevil
  • 1
  • 1