を使用して画像をダウンロードし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
です。助けてください?