2012-03-15 7 views
1

私はWebサービスを呼び出すが、私の呼び出しが記録されていない、それはそうされる理由は、私はわからないunfortunateleyしようとしています... Webサービスに私を呼び出すことができません。私がする必要があるすべてはSafariでもWeb表示に多分、ここ <p></p>は、私が使用していたコードである

おかげで、それをロードすることなく、Webページを読み込むことができるようにすることです

NSURL *URL = [NSURL URLWithString:@"http://www.google.com"]; 
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:URL]; 

NSURLResponse *response = nil; 
NSError *error = nil; 
NSData *data = [NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&error]; 

:何かが足りないのです! iOS版ではWebサービスに接続する方法について

+0

[目的C、Safariで開くことなくWebサイトを開く(サーバーコール用)](http://stackoverflow.com/questions/9726389/objective-c-opening-a-website-without- Safari for Server-Call-Puを開く) – hotpaw2

答えて

0
NSURL *url = [NSURL URLWithString:webService]; 
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60.0]; 
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];  
    if(theConnection) { 
     //webData = [[NSMutableData data] retain];  
    }else { 
     NSLog(@"The Connection is NULL"); 
    } 
} 

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { 
    webData = [[NSMutableData data] retain]; 
} 

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { 
    [webData appendData:data]; 
} 

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { 
} 
関連する問題