Ios 无法使用NSMutableURLRequest下载文件

Ios 无法使用NSMutableURLRequest下载文件,ios,http-headers,nsurlconnection,nsurlrequest,Ios,Http Headers,Nsurlconnection,Nsurlrequest,我正在使用NSMutableRequest对象进行aNSURLConnection以从我的服务器下载文件。服务器只返回了33字节不正确的数据。我正在创建正确的URL -(void)downloadData{ NSURLConnection *connection = nil; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@,myid=%@&dataid=%@",DOWNL

我正在使用
NSMutableRequest
对象进行a
NSURLConnection
以从我的服务器下载文件。服务器只返回了33字节不正确的数据。我正在创建正确的URL

-(void)downloadData{

        NSURLConnection *connection = nil;
        NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@,myid=%@&dataid=%@",DOWNLOAD_URL,my_id,data_id]];


        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:30.0];

       [request setHTTPMethod:@"GET"];
       _myData = [NSMutableData data];
       connection =  [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES]; 


}



- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
    NSLog(@"Downloading Failed");
    myData = nil;
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
    NSLog(@"(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data");

    [myData appendData:data];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
    NSLog(@"Downloading Finished");
    // here you can can save the data in the file.
}
我的回复标题是这样的

HTTP 200 No Error

Server: Apache/2.2.26 (Amazon)
X-Powered-By: PHP/5.3.28
Connection: close
TCN: choice
Content-Type: application/octet-stream
Content-Location: fw_download.php
Date: Wed, 09 Apr 2014 06:44:55 GMT
Content-Disposition: filename="abc.xxx"
Content-Length: 730568
Cache-Control: private
Vary: negotiate

有人能告诉我我做错了什么吗?我希望得到
730568
字节,但我只得到
33
字节

首先检查你的下载url如果我在浏览器中粘贴该url,它将触发文件下载添加
[连接启动]在startDownload方法中你是指在DownloadData方法中?对不起。下载数据。