title: Tableview crashes when reloading data
body: <p>I've unexpected problems with tableviews. It seems that the app quits without a error every time I try to reload my tableviews' data. I know that the array is formed correctly, so there's something wrong with these functions:</p>
  
  <pre><code>func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
          if tableView.tag == 1 {
  
              return latest.count
          }
          else if tableView.tag == 2{
              return older.count
          }
          else {
  
              return 0 //In case of error
          }
  
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
          var cell:UITableViewCell?
  
          if tableView.tag == 1 {
              print("Success")
              cell = tableView.dequeueReusableCell(withIdentifier: "latestCell")! as UITableViewCell
  
              cell = UITableViewCell(style: UITableViewCellStyle.subtitle,
                                     reuseIdentifier: "latestCell")
  
              cell?.textLabel?.text = latest[indexPath.row]
  
              cell?.detailTextLabel?.text = latestSub[indexPath.row]
  
              cell?.accessoryType = .disclosureIndicator
  
              return cell!
  
          }
  
          else if tableView.tag == 2 {
  
              cell = tableView.dequeueReusableCell(withIdentifier: "olderCell")! as UITableViewCell
  
              cell = UITableViewCell(style: UITableViewCellStyle.subtitle,
                                     reuseIdentifier: "olderCell")
  
  
              cell?.textLabel?.text = older[indexPath.row]
  
              cell?.detailTextLabel?.text = olderSub[indexPath.row]
  
              cell?.accessoryType = .disclosureIndicator
  
              return cell!
          }
  
          else {
              return cell!
          }
      }
  </code></pre>
  
  <p>The answers before to these type of questions here were about forgetting to set delegates and datasource and so... So I believe this is an appropriate question.</p>
  
  <p>Thanks in advance! </p>
  
  <p>EDIT:</p>
  
  <pre><code>var latest = [String]()
  
  var older = [String]()
  
  var latestSub = [String]()
  
  var olderSub = [String]()
  
  
  override func viewDidAppear(_ animated: Bool) {
      latestTable.reloadData()
      olderTable.reloadData()
  }
  </code></pre>
  
  <p>The full log;</p>
  
  <p>2017-02-16 15:57:28.889 NotebookApp[24985:604704] Firebase automatic screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO in the Info.plist
  2017-02-16 15:57:28.997 NotebookApp[24985:]  Firebase Analytics v.3600000 started
  2017-02-16 15:57:28.999 NotebookApp[24985:]  To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled 
  2017-02-16 15:57:29.012:  FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
  2017-02-16 15:57:29.020 NotebookApp[24985:]  Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
  2017-02-16 15:57:29.090 NotebookApp[24985:]  The AdSupport Framework is not currently linked. Some features will not function properly. 
  2017-02-16 15:57:29.180 NotebookApp[24985:]  Firebase Analytics enabled
  2017-02-16 15:57:45.703779 NotebookApp[24985:604704] [LayoutConstraints] Unable to simultaneously satisfy constraints.
      Probably at least one of the constraints in the following list is one you don't want. 
      Try this: 
          (1) look at each constraint and try to figure out which you don't expect; 
          (2) find the code that added the unwanted constraint or constraints and fix it. 
      (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
  (
      "",
      ""
  )</p>
  
  <p>Will attempt to recover by breaking constraint 
  </p>
  
  <p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
  The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
  2017-02-16 16:01:34.316879 NotebookApp[24985:604704] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/tuomasnummela/Library/Developer/CoreSimulator/Devices/AA87179A-11E5-4A3A-A63F-B785AA71EC95/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
  2017-02-16 16:01:34.317476 NotebookApp[24985:604704] [MC] Reading from private effective user settings.</p>
  
  <p>I kind of didn't think that there would be anything useful here because when the app quits it doesn't take me to the error-page-thing and highlight any code.</p>
  
  <p><a href="https://i.stack.imgur.com/I2bOE.jpg" rel="nofollow noreferrer">What my project looks like after the app has forcedly closed itself.</a></p>