ios - Split View Controller and UIWebView -


i attempting use split view controller detail view controller shows web site. code of detail view controller follows:

class detailviewcontroller: uiviewcontroller {      @iboutlet weak var webview: uiwebview!      var detailitem: article? {         didset {             // update view.             self.configureview()         }     }      func configureview() {         // update user interface detail item.         if let detail = self.detailitem?.html {             let url = nsurl(string: "http://mywebsite.com" + detail)             println(url)             let requestobj = nsurlrequest(url: url!)             println(requestobj)             webview.loadrequest(requestobj)             }         }     } 

when run program, both println() show results. program throws exception:

optional(http://mywebsite.com/foo)

{ url: http://mywebsite.com/foo } fatal error: unexpectedly found nil while unwrapping optional value

why did find nil? optional value has value?

your webview nil

your didset listener calling code before webview object exists. need ensure webview exists time call it.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -