ios - Warning: Attempt to present View Controller on * which is already presenting <UISearchController: 0x142a1f7c0> -


i made view controller uisearchcontroller , uitableview . there 2 different kind of search can select search scope buttons : groups , people. both searches work , show results on table. however, if click on each cell should direct different dynamic pages (a dynamic group page or dynamic person profile page). 1 groups works, while 1 profiles doesn't. meaning whenever click on person cell results got, nothing happens , following warning printed on console :

warning: attempt present <myproject.profileview: 0x13e9df000>  on <myproject.searchpage: 0x142a1d8f0> presenting <uisearchcontroller: 0x142a1f7c0> 

if have idea why happening it'd appreciated if let me know.

edit : here's function should link cell different view controllers :

func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) {          if self.searchforgroups {              let detailcell:pfobject = self.filteredgroups.objectatindex(indexpath.row) as! pfobject              let vc = self.storyboard!.instantiateviewcontrollerwithidentifier("dynamiccellview") as! dynamiccellview              vc.groupid = detailcell.objectid!              self.presentviewcontroller(vc, animated: false, completion: nil)          }else{             //link use profile             let user = self.peopleresults[indexpath.row]             let vc = self.storyboard!.instantiateviewcontrollerwithidentifier("profileview") as! profileview             vc.profileid = user.objectid!             self.presentviewcontroller(vc, animated: true, completion: nil)         }     } 

i having same warning , fixed me. need stop presenting search controller can present other controller while leaving view.

         override func viewdiddisappear(_ animated: bool) {                  if searchcontroller.isactive == true {                            searchcontroller.isactive = false                   }           }  

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -