NSURLSession completion block not called

前端 未结 6 856
天命终不由人
天命终不由人 2021-02-18 19:07
var session = NSURLSession.sharedSession()
session.dataTaskWithRequest(urlRequest, 
                            completionHandler: {(data: NSData!, 
                             


        
6条回答
  •  佛祖请我去吃肉
    2021-02-18 19:41

    Are you using playgrounds??

    If you are, you should be careful to include:

     XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true)
    

    In order to make the playground wait for the callback

提交回复
热议问题