Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 从服务器获取数据,NSURLConnection显示在TableView中_Ios_Ios7_Get_Nsurlconnection - Fatal编程技术网

Ios 从服务器获取数据,NSURLConnection显示在TableView中

Ios 从服务器获取数据,NSURLConnection显示在TableView中,ios,ios7,get,nsurlconnection,Ios,Ios7,Get,Nsurlconnection,我快死了,请帮帮我 scanCode = @"123"; NSString * urlString=[NSString stringWithFormat:@"http://1-dot-digiphoto-01.appspot.com/v1/service/rest/getAlbums/QR/{%@}",scanCode]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlSt

我快死了,请帮帮我

 scanCode = @"123";
    NSString * urlString=[NSString stringWithFormat:@"http://1-dot-digiphoto-01.appspot.com/v1/service/rest/getAlbums/QR/{%@}",scanCode];



NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];

// Create url connection and fire request
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];

if (!conn)
{
    responseData = nil;
    NSLog(@"Connection Error");

}
检查以下代码:

NSString *urlString = [NSString stringWithFormat:@"http://1-dot-digiphoto-01.appspot.com/v1/service/rest/getAlbums/QR/{%@}",@"123"];

NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];

[theRequest addValue: @"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest setHTTPMethod:@"GET"];

NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

if( connection )
{
    NSLog(@"Success");
}
else
{
    NSLog(@"Failed");
}

我想发送扫描码Sitring是{123,UK111,IND111,USA111,}不确定这是否会产生影响,但您不需要NSString stringWithFormat中的花括号{},您可以这样离开:
NSString*urlString=[NSString stringWithFormat:@”http://1-dot-digiphoto-01.appspot.com/v1/service/rest/getAlbums/QR/%@“,扫描码]@Chenna检查我的答案。它起作用了now@urnotsam我们可以用花括号表示查询字符串。他错过了发送内容模式。一旦他设置了内容模式,如下面我的答案,它一定会工作。@PREMKUMAR你是对的,我的错。你下面的答案是正确的,我会投票给其他有类似问题的人