I am getting this error where trying to submit a request to the paired app. If I execute the same code from inside the app it take a little time as it needs to execute a few url request, but it finally returns. When I do it through a call from the InterfaceController on the Watch extension, I get no return and the timeout elapses instead. I am using a block to process the request as in:
public func session(session: WCSession, didReceiveMessage message: [String : AnyObject], replyHandler: ([String : AnyObject]) -> Void){
var replyValues = [Dictionary<String, AnyObject>]()
switch message["command"] as! String{
case "buspoll":
BackgroundLocationUpdate.sharedUpdater().remoteFetch{(arrivingBuses) in
for index in 0..<arrivingBuses.count {
let element=arrivingBuses[index]
let bus=element.bus
let address=element.address
let destination=element.destination
let location=element.reportingPalina?.location ?? CLLocation()
let time=element.time
let busDestination=String(format: "%@: %@", bus, destination)
let timeLocation=String(format: "%d min. at %@", time, address)
let dict:Dictionary<String, AnyObject>=Dictionary(dictionaryLiteral: ("destination",busDestination), ("time", timeLocation), ("location", location))
replyValues.append(dict)
}
let containingDictionary=Dictionary(dictionaryLiteral: ("response", replyValues))
replyHandler(containingDictionary)
}
default:
break
}
}
if I put the replyHandler outside the block, it gets correctly called and returns to the Watchkit extension. If instead I do it in the block as in the code, nothing happens. Should it be submitted on main thread or what else could be the problem?