开发者

Multiple NSURLConnection Problem

This is my code:

- (void)saveData:(NSString *)url withName:(NSString *)name{

    NSString *URLString=[NSString stringWithFormat:@"http://www.google.com/reader/atom/%@?n=%d&xt=user/-/state/com.google/read", url, 50 ];

    NSLog(@"------>In attesa di %@",URLString);



     NSURL *requestURL = [NSURL URLWithString:URLString];
     NSMutableURLRequest *theRequest = [[NSMutableURLRequest alloc] init];

     [theRequest setHTTPMethod:@"GET"];
     [theRequest setTimeoutInterval:30.0];
     //[theRequest addValue:[NSString stringWithFormat:@"GoogleLogin auth=%@", auth] forHTTPHeaderField:@"Authorization"];
     [theRequest setURL开发者_Go百科:requestURL];

     [self.oauthAuthentication authorizeRequest:theRequest];

     OrignalNSURLConnection *conn = [[OrignalNSURLConnection alloc] initWithRequest:theRequest delegate:self startImmediately:NO];
     conn.originalURL=name;
     conn.stato=@"store";
     [conn start];
     NSLog(@"-------------------------- connection: %@", conn);

     self.web = conn;




     [conn release];

     //NSLog(@"########## get response: %d", [response statusCode]);

     [theRequest release];

}

-(void) storeData{
    for(SubscriptionArray *element in subscriptions){

        [self saveData:element.htmlUrl withName:element.title];

    }
}

If I call storeData only the 1st was written correctly for the others connection I received 0 data maybe because I do a lot of request... How can stop storeData cycle until the data will received? (in the didFinishLoading method)? thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜