ios - unexpectedly found nil while unwrapping an Optional value On UILabel -


in project have implemented protocol makes url call , return result, , intent show result in uilabel. following code :

protocol restapiresult {    func retrivedriverinfo() }  class restapicall :  restapiresult {    func retrivedriverinfo()     {      self.dashboardviewcontroller.getdriverinfo(driverprofile)     // calling function of next view lable setup     } } 

getdriverinfo in nextview has outlet of textview

class dashboardviewcontroller: uiviewcontroller {        override func viewdidload()         {         super.viewdidload()          restdeledate = restapicall()          restdeledate!.retrivedriverinfo()      // if label set here no error       //totaltriplabel.text = "testing"  // no error          }         func getdriverinfo(driverinfoarray : nsarray)        {         totaltriplabel.text = "testing" // here error        }  } 

if text set in viewdidload() doesn't crash. when tried set value in delegate function crash saying found null.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -