在我的一个项目中,我想通过将TTURLXMLResponse传递给请求,使用TTURLRequestModel以XML格式填充响应数据。但是,从不调用委托方法。有人能告诉我这两个文件中缺少什么吗?我是否需要初始化库的其他一些元素?
Three20Parser.h
@interface Three20Parser : TTURLRequestModel{
}
- (void) download;
@end
Three20Parser.m
#import "Three20Parser.h"
#import "extThree20XML/extThree20XML.h"
@implementation Three20Parser
- (id)init{
self = [super init];
return self;
}
- (void) download{
NSString *requestURL = @"http://server.local/service.asmx";
NSLog(@"requestURL: %@", requestURL);
TTURLRequest *request = [TTURLRequest requestWithURL:requestURL delegate:self];
request.cacheExpirationAge = TT_CACHE_EXPIRATION_AGE_NEVER;
request.cachePolicy = TTURLRequestCachePolicyNone;
TTURLXMLResponse *response = [[TTURLXMLResponse alloc] init];
request.response = response;
TT_RELEASE_SAFELY(response);
[request send];
}
/*
the requestDidFinishLoad is not called.
*/
- (void)requestDidFinishLoad:(TTURLRequest *)request{
//TTURLXMLResponse *response = request.response;
//NSLog(@"response: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
NSLog(@"REQUEST DID FINISH", nil);
}
答案 0 :(得分:1)
也许请求失败了?你只是实现了协议的成功方法 - 请求:didFailLoadWithError:改为调用吗?
我实现every method possible仅用于调试以查看正在发生的事情。然后当你使用它时,删除你不需要的onls。
但是,您应该始终检查错误 - 您可能必须告诉用户Apple已经失败,以允许该应用进入应用商店!即使您不必告诉用户,您也应该对此做些什么!