ios-新浪微博开发-16(授权)
2015-09-18 20:24
393 查看
我们使用三方登录 要或得授权 这里新浪给我们授权 登录页面不用自己写只需要用一个webView 加载新浪给我们发送回来的页面 #import "QHOAushiyongthViewController.h" @interface QHOAuthViewController()<UIWebViewDelegate> @end @implementation QHOAuthViewController - (void)viewDidLoad { [super viewDidLoad]; //1.创建webView UIWebView *webView = [[UIWebView alloc]init]; webView.frame = self.view.bounds; [self.view addSubview:webView]; webView.delegate = self; //2.用webView加载登录页面(新浪提供的) //请求地址:https://api.weibo.com/oauth2/authorize //请求参数 client_id=438168078&redirect_uri=http:// NSURL *url = [NSURL URLWithString:@"https://api.weibo.com/oauth2/authorize?client_id=438168078&redirect_uri=http://"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView loadRequest:request]; NSLog(@"-----viewDidLoad"); //invalid_request 参数搞错了 或者没有参数 // Do any additional setup after loading the view. } #pragma mark -webView代理方法 - (void)webViewDidFinishLoad:(UIWebView *)webView { NSLog(@"-----ViewDidFinishLoad"); } - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { NSLog(@"didFailLoadWithError"); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end
相关文章推荐
- ios-新浪微博开发-15(新特性3)
- iOS_词典阵列 按key分组和排序
- ios-控件不显示的问题 总结
- ios-新浪微博开发-14(新特性2)
- ios-新浪微博开发-13-新特性(1)
- iOS中消息的传递机制
- 苹果开发 笔记(77)NSJSONSerialization
- iOS数据解析之NSXMLParser
- xcode 6.4 启动虚拟机自动退出
- ios开发必备10款第三方类库
- 一些iOS常用的第三方库和控件
- iOS MKMapView简单介绍
- ios+phonegap跳转到任意界面
- xcode7,ios9 部分兼容设置 bitcode
- iOS—请求Web Service
- iOS数据解析之json
- xcode7 iOS9 问题大全及解决
- vmstat及iostat检查io问题
- 学习笔记--获取ios当前时间
- iOS 开发:绘制像素到屏幕