Warning: Attempt to present * on * which is already presenting (null)

后端 未结 16 586
盖世英雄少女心
盖世英雄少女心 2021-02-03 17:14

This is my first application for iOS.

So I have a UIVIewController with a UITableView where I have integrated a UISearchBar and a

16条回答
  •  囚心锁ツ
    2021-02-03 17:44

    Building on Mehrdad's answer: I had to first check if the search controller is active (if the user is currently searching):

    if self.searchController.isActive {
        self.searchController.present(alert, animated: true, completion: nil)
    } else {
        self.present(alert, animated: true, completion: nil)
    }
    

    where alert is the view controller to present modally.

提交回复
热议问题