Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone ios身份验证与facebook和服务器端验证_Iphone_Facebook_Oauth - Fatal编程技术网

Iphone ios身份验证与facebook和服务器端验证

Iphone ios身份验证与facebook和服务器端验证,iphone,facebook,oauth,Iphone,Facebook,Oauth,我的iOs应用程序使用Facebook sdk通过Facebook对用户进行身份验证 现在,应用程序连接到服务器,并且必须确认用户身份。推荐哪种方式? 可能iphone必须向服务器发送某种令牌,服务器必须通过facebook api调用进行确认 你有这些文档的链接吗?你好,你想在你的ios应用程序中登录Facebook,我已经使用了这个代码,请检查一下 首先在你的r应用程序中进行web查看,并连接Nib文件,然后输入你的facebook应用程序 - (void)viewDidLoad { [su

我的iOs应用程序使用Facebook sdk通过Facebook对用户进行身份验证

现在,应用程序连接到服务器,并且必须确认用户身份。推荐哪种方式? 可能iphone必须向服务器发送某种令牌,服务器必须通过facebook api调用进行确认


你有这些文档的链接吗?

你好,你想在你的ios应用程序中登录Facebook,我已经使用了这个代码,请检查一下 首先在你的r应用程序中进行web查看,并连接Nib文件,然后输入你的facebook应用程序

- (void)viewDidLoad
{
[super viewDidLoad];

 NSString *client_id = @"Enter your Application ";

NSString *redirect_uri = @"http://www.facebook.com/connect/login_success.html";

NSString *url_string = [NSString stringWithFormat:@"https://graph.facebook.com/oauth/authorize?client_id=%@&redirect_uri=%@&type=user_agent&display=touch", client_id, redirect_uri];

NSURL *url = [NSURL URLWithString:url_string];

NSURLRequest *request = [NSURLRequest requestWithURL:url];

[self.webView loadRequest:request];

}
 -(IBAction)getText:(id)sender{

 NSLog(@"%@",[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.outerHTML"]);
}
- (void)webViewDidFinishLoad:(UIWebView *)_webView {



NSString *url_string = [((_webView.request).URL) absoluteString];
 NSLog(@"%@",url_string);

NSRange access_token_range = [url_string rangeOfString:@"access_token="];

//coolio, we have a token, now let's parse it out....
if (access_token_range.length > 0) {

    int from_index = access_token_range.location + access_token_range.length;
    NSString *access_token = [url_string substringFromIndex:from_index];

    NSLog(@"access_token:  %@", access_token);
   htmldata=[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.outerHTML"];
    NSLog(@"%@",htmldata);
    NSLog(@"%@",url_string);
    NSArray *arr1=[htmldata componentsSeparatedByString:@"<title>"];
    NSString *data=[arr1 objectAtIndex:1];
    NSArray *arr2=[data componentsSeparatedByString:@"</title>"];

    value=[[NSString alloc]initWithString:[arr2 objectAtIndex:0]];

    NSLog(@"%@",value);
    if([value isEqualToString:@"Success"])
    {
        MainScreenController *C = [[MainScreenController alloc]init];
        [self.navigationController pushViewController:C animated:YES];
        [C release]; 
}
}
}
-(void)viewDidLoad
{
[超级视图下载];
NSString*客户端id=@“输入您的应用程序”;
NSString*重定向_uri=@”http://www.facebook.com/connect/login_success.html";
NSString*url_string=[NSString stringWithFormat:@”https://graph.facebook.com/oauth/authorize?client_id=%@&重定向_uri=%@&type=user_agent&display=touch”,客户端_id,重定向_uri];
NSURL*url=[NSURL URLWithString:url_字符串];
NSURLRequest*request=[nsurlRequestRequestWithURL:url];
[self.webView加载请求:请求];
}
-(iAction)getText:(id)发送方{
NSLog(@“%@,[webView stringByEvaluatingJavaScriptFromString:@“document.documentElement.outerHTML]”);
}
-(无效)webViewDidFinishLoad:(UIWebView*)\u webView{
NSString*url_string=[((_webView.request.url)绝对字符串];
NSLog(@“%@”,url_字符串);
NSRange access_token_range=[url_string rangeOfString:@“access_token=“”;
//coolio,我们有一个令牌,现在让我们把它解析出来。。。。
如果(访问令牌\u range.length>0){
int from_index=access_token_range.location+access_token_range.length;
NSString*access_token=[url_string substringfromfromindex:from_index];
NSLog(@“访问令牌:%@”,访问令牌);
htmldata=[webView stringByEvaluatingJavaScriptFromString:@“document.documentElement.outerHTML”];
NSLog(@“%@”,htmldata);
NSLog(@“%@”,url_字符串);
NSArray*arr1=[htmldata组件由字符串分隔:@”“];
NSString*data=[arr1 objectAtIndex:1];
NSArray*arr2=[数据组件由字符串分隔:@”“;
值=[[NSString alloc]initWithString:[arr2 objectAtIndex:0]];
NSLog(@“%@”,值);
如果([值IsequalString:@“Success”])
{
MainScreenController*C=[[MainScreenController alloc]init];
[self.navigationController pushViewController:C动画:是];
[C释放];
}
}
}

谢谢

现在没有任何其他方法可以知道登录成功。其他方法是使用facebook对话框,但你无法从中获得任何成功或失败的价值。你已经更改了facebook sdk的Api,苹果可能会拒绝它。