我試圖將此cURL命令轉換爲objective-c,但無法在「-i」和「-u」關於objective-c庫的信息中找到任何信息。如何將此cURL命令轉換爲目標c
curl -i -u "username" "https:domain.com/v1/authenticate"
我試圖將此cURL命令轉換爲objective-c,但無法在「-i」和「-u」關於objective-c庫的信息中找到任何信息。如何將此cURL命令轉換爲目標c
curl -i -u "username" "https:domain.com/v1/authenticate"
Google "man curl",這比創建SO問題更容易。
-i
(HTTP)在輸出中包含HTTP標頭。在HTTP頭 包括諸如服務器名稱,文件日期,基於HTTP 版本更多...-u
指定用於服務器authentica- 重刑的用戶名和密碼。
感謝您指引我朝着正確的方向發展!沒有必要成爲一個混蛋。 – garnp
curl -X GET
--header "Accept: application/json"
--header "app_id: 999999"
--header "app_key: xxxxxxx"
--header "Dev-Mode: true" "https://api.infermedica.com/v2/symptoms"
Objective-C代碼
(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//CURL
//curl -X GET --header "Accept: application/json" --header "app_id: 795edb00" --header "app_key: c68cb95e54ec04f44544bb5fd7ab5125" --header "ev-Mode: true" "https://api.infermedica.com/v2/symptoms"
NSString *str = [NSString stringWithFormat:@"https://api.infermedica.com/v2/symptoms;app_id=795edb00;app_key=c68cb95e54ec04f44544bb5fd7ab5125"];
NSURL *url = [[NSURL alloc]initWithString:str];
NSData *data = [[NSData alloc ]initWithContentsOfURL:url];
arr = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
NSLog(@"%@",arr);
你嘗試過什麼?你如何在Objective-C代碼中替換curl?你在使用圖書館嗎?你知道什麼-i和-u嗎?你有什麼試圖替換他們的調用?你的問題缺乏所有這些信息。 –
[爲目標C轉換CURL命令]可能的重複(http://stackoverflow.com/questions/8982707/converting-a-curl-command-for-objective-c) –