Delegate method NSURLConnection: didReceiveData is not called ... Why? (iPhone SDK)

Sample code:

-(void)ConnectWithRequest:(NSMutableURLRequest*)req{

if(![req isEqual:theRequest]){
    [req retain];
    [theRequest release];
    theRequest = req;
}

XMLConnection = [[XMLWebServiceConnection alloc]init];  
Connection=[[NSURLConnection alloc]initWithRequest:theRequest delegate:XMLConnection];
}

      

In the XMLConnection class, I have implemented the delegation methods NSURLConnection

:

-(id)init{

    if(self=[super init]){
        receivedData = [[NSMutableData alloc]init]; //member of a class
    }
    return self;
}


- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
    [receivedData release];
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
    [receivedData setLength:0]; 
}

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

- (void)connectionDidFinishLoading:(NSURLConnection *)connection{

    NSString *theXML = [[NSString alloc] initWithBytes: [receivedData mutableBytes] length:[receivedData length] encoding:NSUTF8StringEncoding];

    NSLog(@"\nResponse printed :\n\n\n %@\n",theXML);

    [theXML release];

}

      

when i run this code,

method:

connection:(NSURLConnection *)connection didReceiveData:(NSData *)data

      

not called, why is this happening? How to solve this problem?


thank

+1
iphone uiwebview


source to share


No one has answered this question yet

See similar questions:

3
NSURLConnection - didReceiveData not called - iOS & ARC

or similar:

five
Requests Related to NSURLConnection Delegation Methods
3
NSURLConnection is shown as leaking devices
2
passing the parameter to the working code of the web service
1
cannot get parameter in webservice
1
how to write xml data to plist file in iphone?
1
UIProgressbar at Cococa Touch
1
Uploading video file to url
0
how to compare HTTP NSURLconnection response data with string value in iphone?
0
New question: NSOperation for iphone SDK
0
What is the procedure for performing wsdl analysis in iphone?



All Articles
Loading...
X
Show
Funny
Dev
Pics