---
title: "IOS  HTTP 同步请求"
author: "jguangyou"
date: "2012-12-04T17:20:42Z"
tags: []
categories: ["移动开发"]
slug: "ios-http"
draft: false
lastmod: "2012-12-04T17:20:42Z"
id: 1741017
url: "https://deep-fish.iteye.com/blog/1741017"
---

NSURL* url = \[NSURL URLWithString:urlString];

    NSURLRequest* request = \[NSURLRequest requestWithURL:url cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:10];

NSData* data = \[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];

        NSString \*aString = \[\[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];