注意设置plist文件中的 AppTransport
let str = "https://lanhuapp.com/web/#/item/project/board/detail?type=share_mark&pid=0424f944-7878-42f5-bef5-60caf0f9fa3a&activeSectionId=&teamId=8b236f9d-7a13-4b41-8170-99696b04efe7¶m=c47046a3-0abb-423b-b4ff-007e02c1a869&project_id=0424f944-7878-42f5-bef5-60caf0f9fa3a&image_id=93c25942-7ba9-444e-9405-5f4eb0335c2f"
let url : NSURL = NSURL(string: str)! as URL as URL as NSURL
let request = URLRequest(url: url as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 30)
let session = URLSession.shared
let dataTask = session.dataTask(with: request) { (data, respons, error) in
print(error as Any)
if data == nil {return}
if respons == nil {return}
let str = String(data: data!, encoding: .utf8)
print(str as Any)
print(respons!)
}
dataTask.resume()
网友评论