title: UITableView unrecognized NumberOfRowsInSection
body: <p>i am getting this error.
  I am working with SQLite. I have some data and i want to display the data in sections so i added a column that will be my section name, called "cittaTerritorio".
  Now i am retrieving my data and sorting it using this column,
  When i run the code everything crash with this message:</p>
  
  <blockquote>
    <p>-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x101c3ce50
    2017-10-14 17:14:44.893258+0200 MinistryHelp[403:44322] <strong>* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x101c3ce50'
    *</strong> First throw call stack:
    (0x1812b3d38 0x1807c8528 0x1812c11f8 0x18aa7bcc4 0x1812b96e4 0x18119f0dc 0x18aa02cc8 0x18a7908d8 0x18a7900a4 0x18a78fe34 0x18a78fc44 0x18a81c14c 0x1008cfc60 0x1008cf040 0x1008cfedc 0x18a6c3bfc 0x18a76c128 0x18a76b5c8 0x18a76afcc 0x18a76aa34 0x18a76a95c 0x18a6c1000 0x1852910b4 0x185295194 0x185203f24 0x18522a340 0x18522b180 0x18125b8b8 0x181259270 0x18125982c 0x18117a2d8 0x18300bf84 0x18a727880 0x1008c62d0 0x180c9e56c)
    libc++abi.dylib: terminating with uncaught exception of type NSException</p>
  </blockquote>
  
  <p>Have you any idea? That is my code:</p>
  
  <pre><code>    func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -&gt; String? {
      return self.listCitta()[section]
  }
  
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return self.territoriInCitta(section: section).count
  }
  
  func numberOfSections(in tableView: UITableView) -&gt; Int {
      return self.listCitta().count
  }
  
  func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
      return self.listCitta().count
  }
  
  func territoriInCitta(section: Int)-&gt; [String]{
      let nomeSezione = tableview.headerView(forSection: section)?.textLabel?.text
      var listaCitta = [String]()
      listaCitta.removeAll()
      do{
          let territori = try self.database.prepare(territoryTable.filter(cittaTerritorio == nomeSezione!))
          for territorio in territori{
              listaCitta.append(territorio[self.cittaTerritorio])
          }
      }catch{
          print(error)
      }
      return listaCitta
  }
  
  func listCitta()-&gt; [String]{ //aggiunge i vari nomi delle citta
      var listaCitta = [String]()
      listaCitta.removeAll()
      do{
          let terr = try self.database.prepare(territoryTable.select(cittaTerritorio))
          for territorio in terr{
              if listaCitta.contains(territorio[self.cittaTerritorio]){
                  //nil
              }
              else{
                  listaCitta.append(territorio[self.cittaTerritorio])
              }
          }
      }catch{
          print(error)
      }
      return listaCitta
  }
  </code></pre>
  
  <p>with the first function i get the sections name based on the index of the list my method returns.
  The second functions returns the number of the data based on the section so i filter the data based on that section name and than return the number using a list.
  the third and the fourth method return the number of the sections.</p>
  
  <p>I also tried inserting fake data, writing a number for test purpose, nothing went different.</p>