import Foundationclass TestURLSession{var session: NSURLSession!func run(){ session = NSURLSession.sharedSession() let url = NSURL(string: "http://www.veenex.de/tmp/Json") let request = NSMutableURLRequest(URL: url!) request.setValue("application/Json; charset=utf-8",forhttpheaderFIEld: "Content-Type") request.httpMethod = "GET" let getDataTask = session.dataTaskWithRequest(request,completionHandler: {(data,response,error) in // http Response contains an error if let httpResponse = response as? NShttpURLResponse { if httpResponse.statusCode != 200 { print("response was not 200: \(response)") return } } // Error submitting Request if error != nil { print("error submitting request: \(error)") return } // print data if data != nil{ do { let Json = try NSJsONSerialization.JsONObjectWithData(data!,options: NSJsONReadingOptions.MutableContainers) as! NSArray for entry in Json { print(entry) } } catch { print("Error printing data") } } }); getDataTask.resume()}}let testURLSession = TestURLSession()testURLSession.run()
但是我收到错误消息:“运行代码时出错:未知错误代码132”.
在Xcode Playground中执行代码它可以工作.
NSURLSession.swift
文件. 每个方法都是NSUnimplemented(),这意味着它尚未实现.在此类完成之前,它将无法在linux和IBM的Swift SandBox上使用.
总结以上是内存溢出为你收集整理的linux – IBM Swift Sandbox:运行NSURLSession:运行代码时出错:未知错误代码132全部内容,希望文章能够帮你解决linux – IBM Swift Sandbox:运行NSURLSession:运行代码时出错:未知错误代码132所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)