title: Making simple HomeKit app from tutorial and getting error appending HMAccessory
body: <p>I am following this tutorial:<br>
  <a href="http://www.xmcgraw.com/learn-how-to-create-an-ios-app-using-homekit/" rel="nofollow noreferrer">http://www.xmcgraw.com/learn-how-to-create-an-ios-app-using-homekit/</a><br>
  There is a link in the article to GitHub that has the code.</p>
  
  <p>I'm trying to get a simple HomeKit app up and running to turn on and off a light. I've read through Apple's guide to getting started with HomeKit. I do have a paid Apple developer membership and the provisioning profile allows me to build the app and run it on my iPhone (6s with iOS 10.2). I am using Xcode 8.2.1 and I have the HomeKit Accessory Simulator working and I can see the simulated lights I've created because I can print them to the console, they all show up by name.</p>
  
  <p>The problem is, I cannot add them to the accessories array and get them added to the table view as cells. I have checked and re checked that the reuse identifier "accessoryId" on my cells matches what I'm using in my code.</p>
  
  <pre><code>func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      if let cell = tableView.dequeueReusableCell(withIdentifier: "accessoryId")  as UITableViewCell? {
          tableView.register(UITableViewCell.self, forCellReuseIdentifier: "accessoryId")
          let accessory = accessories[indexPath.row] as HMAccessory
          cell.textLabel?.text = accessory.name
          return cell
      }
      return UITableViewCell()
  }
  </code></pre>
  
  <p>I've looked through many other questions on SO regarding the same error and none of the fixes seemed to help.</p>
  
  <p>When accessories.append(accessory) is commented out, the print function will console log all of the names of the found accessories from the simulator correctly.</p>
  
  <pre><code>func accessoryBrowser(_ browser: HMAccessoryBrowser, didFindNewAccessory accessory: HMAccessory) {
      print(accessory.name)
  
      accessories.append(accessory)
      tableView.reloadData()
  }
  </code></pre>
  
  <p>but when I uncomment accessories.append(accessory), I get this error</p>
  
  <blockquote>
    <p>UITableView... failed to obtain a cell from its datasource"</p>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/EWvfr.png" alt="error"></p>
  
  <p>How can I solve it?</p>