html 弹出加载页面代码,如何从html代码加载页面

下面是问题,我使用AFNetwoking获取页面html返回。 我可以看到responseObject是一个html页面。 这是我使用的代码。如何从html代码加载页面

NSURL *url = [NSURL URLWithString:@"https://graph.z.qq.com/moc2/authorize"];

AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];

NSMutableDictionary *params = [[NSMutableDictionary alloc] init];

[params setValue:@"code" forKey:@"response_type"];

[params setValue:@"100266567" forKey:@"client_id"];

[params setValue:@"http://www.qq.com" forKey:@"redirect_uri"];

NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET" path:@"https://graph.z.qq.com/moc2/authorize" parameters:params];

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];

[httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]];

__block NSData * data = [[NSData alloc] init];

[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject){

data = responseObject;

NSLog(@"Response: %@", [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]) ;

} failure:^(AFHTTPRequestOperation *operation, NSError *error){

NSLog(@"Error: %@", error);

}];

[operation start];

现在我想将响应对象加载到uiwebview中。 我试过loadHTMLString,但没有奏效。

[webView loadHTMLString:[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] baseURL:url ];

有没有人有这方面的想法?

2013-07-28

zedzhao

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值