简单ios url请求
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了简单ios url请求相关的知识,希望对你有一定的参考价值。
Simple synchronous web request for ios.// Credit to the original authors:
// Sam Walton
// Ethan Irish
// www.seven-labs.com
// Be kind & share :)
// Quick synchronous URL request NSURLResponse *response; NSError *error; NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; // need to check for errors, like if it was a bad call there will be no responsestring // but your error will have some data if(!error) { NSLog(@"response = %@", responseString); // Take all data and split into array by comma // Just a test var called testItem at the index of 10 NSLog(@"test item at 10 = %@", testItem); } // Authors: // Sam Walton // Ethan Irish // www.seven-labs.com // Be kind & share :)
以上是关于简单ios url请求的主要内容,如果未能解决你的问题,请参考以下文章