I download Images Using ASIHTTPRequest
. I wrote This Code:
+(void)GetImagesURL
{
NSLog(@"%i",[TripsArray count]);
for (int i=0;i< [TripsArray count]; i++)
{
NSURL *DetailTripURL = [NSURL URLWithString:[[TripsArray objectAtIndex:i] TripURL]];
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:DetailTripURL];
[request setCompletionBlock:^{
NSData *TripHTMLData = [request responseData];
NSLog(@"url : %@",DetailTripURL);
[[TripsArray objectAtIndex:i] setTripData:TripHTMLData];
//NSLog(@"%@",DetailTripHTMLData);
// 2
TFHpple *DetailTripParser = [TFHpple hppleWithHTMLData:TripHTMLData];
// Get Image
NSString *ImageTripXpathQueryString = @"//div[@class='image_container']/img";
NSArray *ImageTripNodes = [DetailTripParser searchWithXPathQuery:ImageTripXpathQueryString];
NSLog(@"%i",[ImageTripNodes count]);
for (int j=0 ;j<[ImageTripNodes count]; j++)
{
[[TripsArray objectAtIndex:i] setImageUrl:[[ImageTripNodes objectAtIndex:j] objectForKey:@"src"]];
NSLog(@"%@",[[ImageTripNodes objectAtIndex:j] objectForKey:@"src"]);
}
}];
[request setFailedBlock:^{
NSError *error = [request error];
NSLog(@"Get Image URL Failed %@", error.localizedDescription);
}];
[request startAsynchronous];
}
[[NSNotificationCenter defaultCenter] postNotificationName:@"Get Images URL Success" object:self];
}
i want postNotificationName
To Call Another Function .
The Problem is NSNotificationCenter
, not postNotificationName
.
Any Help Please ?