我使用ASIHTTPRequest
. 我写了这段代码:
+(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];
}
我想postNotificationName
调用另一个函数。
问题是NSNotificationCenter
,不是postNotificationName
。请问有什么帮助吗?