Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSString *urlString;
- urlString = [NSString stringWithFormat:@"%@://%@:%@/",kHttp,_IP,_Port];
- NSURL *url = [NSURL URLWithString:urlString];
- // Set authorization
- AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
- [httpClient setAuthorizationHeaderWithUsername:_User password:_Pass];
- NSURLRequest *request = [httpClient requestWithMethod:@"POST" path:@"Info.htm" parameters:nil];
- AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
- [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
- if ([self parseInfoLive:operation.responseString])
- _count_parsed++;
- if (_count_parsed == 2)
- [[NSNotificationCenter defaultCenter] postNotificationName:@"downloadsComplete" object:nil];
- }
- failure:^(AFHTTPRequestOperation *operation, NSError *error) {
- NSLog(@"Error during connection: %@",error.description);
- [[NSNotificationCenter defaultCenter] postNotificationName:@"errorConnecting" object:nil];
- }];
- [operation start];
Add Comment
Please, Sign In to add comment