0
此方法的iOS的等效代碼是什麼?iOS UrlEncodedFormEntity Equivalent
public static String post(String url, String json_content) {
try {
HttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("", json_content.toString()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = client.execute(httppost);
String responseBody = EntityUtils.toString(response.getEntity());
Log.i("responseBody", responseBody);
return responseBody;
} catch (Exception e) {
e.printStackTrace();
}
// Internal Error
return "ierror";
}