Perform POST request in iOS Swift

前端 未结 2 1114
不知归路
不知归路 2021-01-03 12:07

I am trying perform a POST request and the request does not go through. I have looked through Perform POST request in Swift already but it does not contain what I\'m looking

2条回答
  •  执笔经年
    2021-01-03 12:47

    As @jcaron points out, this post is full of bad edits. There's a lot of variables that have different names later in the function and so on. Not to mention you should NEVER post your api key in a SO question or anywhere on the internet for that matter.

    To answer your question on to do a post request in Swift, unless you need incredibly granular control over the process, take a look at Alamofire (same guy that wrote AFNetworking). A POST request is as simple as Alamofire.request(.POST, "http://someapiurl.com") You can also pass in a dictionary of body parameters if you so choose.

提交回复
热议问题