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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -