Ich erhalte einen Fehler wie unten, während ich auf TableView tippe, nachdem ich auf Suchen geklickt habe.Swift 2, nicht erkannter Selektor an Instanz für UIAlertController gesendet
Fehler unter 2016.06.03 11: 20: 31,578 ContactPLUS [1724: 678.512] Achtung: Der Versuch, auf zu präsentieren, die bereits präsentiert (null) st >> 2016.06.03 11 : 20: 32,001 ContactPLUS [1724: 678.512] - [_ UIAlertControllerAlertPresentationController adaptivePresentationController]: auf Grund *** app Abschluss unerkannte Selektor Instanz gesendet 0x1616570d0
2016-06-03 11: 20: 32,001 ContactPLUS [678.512 1724] Nicht abgefangene Ausnahme 'NSInvalidArgumentException', Grund: '- [_ UIAlertControllerAlertPresentationController adaptive PresentationController]: unerkannten Selektor Instanz gesendet 0x1616570d0'
*** Erstschlingen Aufrufliste: (0x182876e38 0x181edbf80 0x18287dccc 0x18287ac74 0x182778d1c 0x18836433c 0x1880117f8 0x187d20740 0x187c72fd8 0x187c80990 0x1879b24a4 0x18282c7b0 0x18282a554 0x18282a984 0x182754d10 0x18403c088 0x187a29f70 0x1000f8070 0x1822f28b8) libC++ abi.dylib: endet mit abgefangene Ausnahme vom Typ NSException
Mein Code unten
Möchten Sie in der Funktion
dispatch_async(dispatch_get_main_queue()) {
self.searchActivityLoader.stopAnimating()
self.searchActivityLoader.hidden = true
self.showError(self.noDataFound)
}
Logic Alert-Controller angezeigt werden:
func showError(errorStr: String){
dispatch_async(dispatch_get_main_queue(), {
if(!errorStr.isEmpty){
let alertController = self.controllerUtil!.customOkAlert("Fail",buttonTitle:"OK" , alertMessage: errorStr)
self.presentViewController(alertController, animated: true, completion: nil)
//**Error comes after executing above two lines**
}
self.genericArr = []
self.contactsTableView.dataSource = self
self.contactsTableView.reloadData()
self.searchActivityLoader.stopAnimating()
self.searchActivityLoader.hidden = true
})
}
/// CustomeOkAlert
// Alert-Controller mit Standardaktionen und benutzerdefinierte Nachrichten
verwaltenfunc customOkAlert(alertPageTitle: String,buttonTitle: String, alertMessage: String) -> UIAlertController
{
let customeAlert = UIAlertController(title: alertPageTitle, message: alertMessage, preferredStyle: UIAlertControllerStyle.Alert)
customeAlert.view.layer.cornerRadius = 10
customeAlert.view.backgroundColor = utility.uicolorFromHex(0xEBEBED)
customeAlert.view.tintColor = utility.uicolorFromHex(0x70B420)
let cancelAction: UIAlertAction = UIAlertAction(title: buttonTitle, style: .Default){action in
//do nothing
}
customeAlert.addAction(cancelAction)
return customeAlert
}
können Sie die customOkAlert() -Methode? – Mathews
Sicher, jetzt hinzugefügt –
Kannst du ein 'print (" someText ")' in deine 'showError' Funktion einfügen, um zu sehen, ob es zweimal aufgerufen wird? – Laffen