1
我的iOs應用使用Facebook-sdk對Facebook用戶進行身份驗證。與Facebook和服務器端驗證的ios身份驗證
現在應用程序連接到服務器並且必須確認用戶身份。哪個是推薦的方式? 可能iphone必須發送某種令牌給服務器,並且服務器必須通過Facebook的api調用確認它
您是否有鏈接到這些文檔?
我的iOs應用使用Facebook-sdk對Facebook用戶進行身份驗證。與Facebook和服務器端驗證的ios身份驗證
現在應用程序連接到服務器並且必須確認用戶身份。哪個是推薦的方式? 可能iphone必須發送某種令牌給服務器,並且服務器必須通過Facebook的api調用確認它
您是否有鏈接到這些文檔?
您好ü要在iOS應用程序與Facebook登錄我有使用此代碼爲它請檢查 先取Web視圖中你讀應用程序,並做護理文件的連接。而輸入你的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];
}
}
}
感謝
感謝,但這並不使用SDK - 這是標準的方式... – 2012-03-10 04:23:41
現在沒有任何其他途徑知道登錄成功。而otherway使用Facebook的對話框,但你不能從中得到任何價值成功或不會失敗.u有改變Facebook的SDK的API和蘋果可能會拒絕它。 – parag 2012-03-10 04:34:10