2016-11-15 2 views
0
class SelectionBoxViewController: UITableViewController,UISearchBarDelegate { 
    var searchbar = UISearchBar() 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     searchbar.delegate = self 
    } 

    func searchBar(searchBar: UISearchBar, textDidChange searchText: String) { 
     tableView.reloadData() 
    } 
} 

EXC_BAD_ACCESS으로 tableView.reloadData()에 충돌했습니다.테이블 뷰 컨트롤러에서 데이터로드 실패

+0

게시물 충돌의 스택 트레이스 그래서 우리는 내가 그것을가있는 UITableViewController이라는 crashh – Lefteris

+0

원인을 이해할 수 있고, 그 총알은 기본적으로 존재해야한다. – henry

답변

0

이 중 2 일 (포함) 될 수있다 : 당신은 UITableViewDataSource의 스토리 보드

  • 필요한 대의원에있는 tableView에 클래스를 연결하지 않은

    • 가 구현되지 않은

    클래스에이 기능을 추가하십시오 :

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
        return 0 
    } 
    

    그리고 일을 하나입니다

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 
        return UITableViewCell() 
    } 
    
  • +1

    참고 스택 추적을 찾을 수있는 충돌 –

    +0

    아마드가 옳다. 나는 여기에 모든 코드를 두지 않는다. – henry