Problems with Watchkit Extension NSURLSession in Swift -


i'm trying call local api turn off house lighting watch, i'm having trouble calling url within watchkit extension.

in viewcontroller (iphone app) i've got same code (which works), somehow doesn't work when call in interfacecontroller watchkit extension.

@ibaction func confirmtapped() {      let url = nsurl(string: "http://homeserver.local/api/lights/4/0")     let task = nsurlsession.sharedsession().datataskwithurl(url!) {(data, response, error) in         print(nsstring(data: data!, encoding: nsutf8stringencoding))     }      task!.resume() } 

i've attached gist: https://gist.github.com/f72125cd4678069af7af.git

am missing obvious?

i don't know if it's thing start nsurlsession within watch extension. if request takes long, cancelled.

maybe ping watch via openparentapplication:reply , handle nsurlsession on iphone app.


Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -