-1
如何在不使用任何外部库的情况下在Swift4中发送带有以下参数的HTTP Get请求?在Swift4中添加HTTP标题和参数
URL: "https://api.newsapi.aylien.com/api/v1/stories"
Parameters = ["categories.confident": "true", "source.name" : "The New York Times", "cluster" : "false", "cluster.algorithm" : "lingo", "sort_by" : "published_at", "sort_direction" : "desc", "cursor" : "*", "per_page" : "10"]
Headers = ["X-AYLIEN-NewsAPI-Application-ID": "App-ID-Here", "X-AYLIEN-NewsAPI-Application-Key": "App-Key-Here"]
你斯威夫特3.使用'URLRequest'和'URLSession'做同样的方式。 –
如何在URLRequest中添加参数和标题? – pranavhgupta
这不是一个难题。你在问如何做最基本的功能。阅读文档。 –