Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.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
Iphone 美国支持的url NSURLConnection_Iphone - Fatal编程技术网

Iphone 美国支持的url NSURLConnection

Iphone 美国支持的url NSURLConnection,iphone,Iphone,我希望lazyload在我的应用程序,所以我下载图像使用NSURLConnection,你可以看到 premiumRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"www.aaaaaaaaa.com/aaaaaaaaa/api/uploads/company_logo/cc2ab63fd3eb564be64b4f21bd083bc7.png"] cachePolicy:NSURLReque

我希望lazyload在我的应用程序,所以我下载图像使用NSURLConnection,你可以看到

premiumRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"www.aaaaaaaaa.com/aaaaaaaaa/api/uploads/company_logo/cc2ab63fd3eb564be64b4f21bd083bc7.png"]
                   cachePolicy:NSURLRequestUseProtocolCachePolicy
                timeoutInterval:60.0];

premiumConnection=[[NSURLConnection alloc] initWithRequest:premiumRequest delegate:self];
但不幸的是,我得到以下错误

error downloading: unsupported URL

如果将url粘贴到浏览器上,它可以正常工作,但在NSURLConnection中不起作用,请帮助解决上述url的问题。

尝试在您的url中包含适当的url方案,例如

...[NSURL URLWithString:@"http://www...

尝试在url中包含适当的url方案,例如

...[NSURL URLWithString:@"http://www...
NSURL*webURL=[NSURL URLWithString:@“您的URL在此”]; NSMutableURLRequest*请求=[[NSMutableURLRequest alloc]initWithURL:webURL]; [请求setTimeoutInterval:60.0]; [请求设置HttpMethod:AstgetorPost]; n错误*错误; NSURLResponse*响应; NSData*returnData=[NSURLConnection sendSynchronousRequest:request returningResponse:&响应错误:&错误]; 如果(返回数据) { //对数据执行您希望执行的操作 } 其他的 { //显示故障警报 } NSURL*webURL=[NSURL URLWithString:@“您的URL在此”]; NSMutableURLRequest*请求=[[NSMutableURLRequest alloc]initWithURL:webURL]; [请求setTimeoutInterval:60.0]; [请求设置HttpMethod:AstgetorPost]; n错误*错误; NSURLResponse*响应; NSData*returnData=[NSURLConnection sendSynchronousRequest:request returningResponse:&响应错误:&错误]; 如果(返回数据) { //对数据执行您希望执行的操作 } 其他的 { //显示故障警报 } //[NSURLConnection connectionWithRequest:[request autorelease]委托:self]

NSURLConnection *nsUrlConnection=[[NSURLConnection alloc]
                                  initWithRequest:request 
                                  delegate:self];

// Successful connection.
if (nsUrlConnection) {

    [self indicatorView];
   // [self initSpinner];
   // [self spinBegin];

    NSMutableData *data = [[NSMutableData alloc] init];
    self.receivedData=data;
    [data release];
} 
// Unsuccessful connection.
else {

}  
// Clean up
[url release];
[request release];
正确设置属性之后,您将得到任何错误

按下答案的向上箭头,对答案进行表决

//[NSURLConnection connectionWithRequest:[request autorelease]委托:self]

NSURLConnection *nsUrlConnection=[[NSURLConnection alloc]
                                  initWithRequest:request 
                                  delegate:self];

// Successful connection.
if (nsUrlConnection) {

    [self indicatorView];
   // [self initSpinner];
   // [self spinBegin];

    NSMutableData *data = [[NSMutableData alloc] init];
    self.receivedData=data;
    [data release];
} 
// Unsuccessful connection.
else {

}  
// Clean up
[url release];
[request release];
正确设置属性之后,您将得到任何错误

按下答案的向上箭头,对答案进行表决