在我的应用程序中,我需要调用一个函数,该函数又调用许多函数。问题是我调用了这个getweather
函数,它开始了startprocess
,然后这个过程完成了。该processCompleted
方法由 调用,rssparser
并且该值在方法结束时可用processCompleted
。
-(void) getWeather: (NSDictionary *) dictionary {
_rssParser = [[BlogRssParser alloc]init];
self.rssParser.address = addressInterestedIn;
self.rssParser.delegate = self;
[[self rssParser]startProcess];
}
//Delegate method for blog parser will get fired when the process is completed
-(void)processCompleted
{
NSLog(@"the rssItems array is %@", [[[self rssParser]rssItems] description]);
int woeid = [[[[self rssParser] rssItems] objectAtIndex:0] intValue];
// get weather update from yahoo
NSLog(@"temperature option %d", [[[NSUserDefaults standardUserDefaults] objectForKey:@"temperature"] intValue]);
SCYahooWeatherParser *parser = [[SCYahooWeatherParser alloc] initWithWOEID:woeid weatherUnit: [[[NSUserDefaults standardUserDefaults] objectForKey:@"temperature"] intValue]];
//parse the returned xml from yahoo
SCWeather *result = [parser parse];
[parser release];
NSLog(@"the conditionDataDict is %@", [result.conditionDataDict description]);
}
我如何获取processCompleted
方法返回的值,因为我已经调用了getWeather
函数。