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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -