它在xcode 7.3.1和ios 9.3中运行良好,但在更新xcode后就停止了
这是我使用的代码
-(IBAction)ClickFacebook:(id)sender
{
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login
logInWithReadPermissions: @[@"public_profile",@"email"]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
if (error)
{
//NSLog(@"Process error");
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
[loginManager logOut];
[FBSDKAccessToken setCurrentAccessToken:nil];
}
else if (result.isCancelled)
{
NSLog(@"Cancelled");
}
else
{
FBSDKGraphRequest *requestFB = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/me"
parameters:@{ @"fields": @"name,email"}
HTTPMethod:@"GET"];
[requestFB startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result,NSError *error)
{
//NSLog(@"%@",result);
NSString * strName=[result valueForKey:@"name"];
NSString * strEmail=[result valueForKey:@"email"];
// [[NSUserDefaults standardUserDefaults]setValue:strEmail forKey:@"EMAIL"];
// [[NSUserDefaults standardUserDefaults]setInteger:1 forKey:@"Logged_in"];
// [[NSUserDefaults standardUserDefaults]setValue:strName forKey:@"NAME"];
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SignupJob *viewController = [sb instantiateViewControllerWithIdentifier:@"signupjob"];
viewController.strEmail=strEmail;
viewController.strName =strName;
[self.navigationController pushViewController:viewController animated:YES];
}];
}
}];
}
但在facebook登录后,它不会返回到本机应用程序,当我调试代码时,它会掉进去。
else if (result.isCancelled)
{
NSLog(@"Cancelled");
}
循环,我得到了控制台错误,就像这样
流:finish _ connect 2016-11-08 11:55:02.424070 OPT作业[2410:49655][]NW _ CONNECTION _ endpoint _ report[16 graph.facebook.com:443就绪解析器(已满足)]上报事件流:finish _ connect 2016-11-08 11:55:02.424919 OPT作业[2410:49661][]_ _ TCP _ CONNECTION _ start _ block _ invoke 16发送事件 TLS:自开始2016-11-08 11:55:02.445829 OPT作业[2410:49655][]NW _ endpoint _ flow _ protocol _ Connected[17.1 31.13.78.13:443 in _ progress socket-flow(已满足)]输出协议Connected 2016-11-08 11:55:02.447545 OPT作业[2410:49655][]NW _ 1 NW _ CONNECTION _ endpoint _ report[17 graph.facebook.com:443就绪解析器(已满足)]上报事件流程:finish _ connect 2016-11-08 11:55:02.449908 OPT JOBS[2410:49558][]_ _ TCP _ CONNECTION _ start _ block _ invoke 17发送事件TCP _ CONNECTION _ EVENT _ TLS _ HANDSHAKE _ COMPLETE响应状态就绪和错误(null)2016-11-08 11:55:02.54444 TLS:自开始2016-11-08 11:55:02.747101 OPT作业[2410:49551][]NW _ Socket _ handle _ Socket _ Event mask:0x 4 2016-11-08 11:55:02.747501 OPT作业[2410:49662][]TCP _ connection _ cancel 16 2016-11-08 31字节):套接字已关闭2016-11-08 11:55:02.749475 OPT作业[2410:49551] [] nw_endpoint作业[2410:49551] [] nw_endpoint nw_socket_handle_socket_event套接字收到WRITE_CLOSE事件2016-11-08 11:55:02.869206 OPT作业[2410:49661][]NW _ endpoint _ handler _ cancel[17 graph.facebook.com:443就绪解析器(已满足)] 2016-11-08 11:55:02.869432 OPT作业[2410:49661][]NW _ endpoint _ handler _ cancel[17
所以有人能帮我找出ios10和xcode 8的解决方案吗
**In Capabilities tab Keychain Sharing should be enable.**
**Also Make sure you have added this to your plist**
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb648725325301980</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>648725325301980</string>
<key>FacebookDisplayName</key>
<string>MeetBox</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
- **If it is still not working then replace your code with this**
**Swift**
-(IBAction)ClickFacebook:(id)sender
{
let loginManager = FBSDKLoginManager()
loginManager.logOut()
loginManager.logIn(withReadPermissions: ["public_profile", "email", "user_friends", "user_likes", "user_relationship_details", "user_relationships"], from: self, handler: {(result , error) -> Void in
print("Value of Result is \(result)")
print("Value of Error is \(error)")
if (error != nil) {
let cont = UIAlertController(title: "Error", message: "Something Went Wrong", preferredStyle: .alert)
let okAction = UIAlertAction(title: "Ok", style: .default, handler: {(action: UIAlertAction) -> Void in
})
cont.addAction(okAction)
self.present(cont, animated: true, completion: { _ in })
}
else if (result?.isCancelled)!
{
}
else
{
if (FBSDKAccessToken.current() != nil)
{
let homeVC = self.storyboard?.instantiateViewController(withIdentifier: "HomeViewController")
self.navigationController?.pushViewController(homeVC!, animated: true)
FBSDKGraphRequest.init(graphPath: "me", parameters: nil).start(completionHandler: {(connection, result, error) -> Void in
print("Value of Error is", error)
print("Value of Result is", result)
if error == nil
{
FBSDKGraphRequest.init(graphPath: "me", parameters: ["fields":"picture.width(500).height(500),first_name,email,last_name,location,gender,likes,interested_in,friends"]).start(completionHandler: {(connection, result, error) -> Void in
print("ResultArray: ",result)
})
}
})
}
}
})
}
**Objective C**
-(IBAction)ClickFacebook:(id)sender
{
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc]init];
[loginManager logOut];
[loginManager logInWithReadPermissions:@[@"public_profile",@"email",@"user_friends",@"user_likes",@"user_relationship_details"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult result, NSError error) {
NSLog(@"Value of Result is %@",result);
NSLog(@"Value of Error is %@",error);
if (error)
{
UIAlertController *cont = [UIAlertController alertControllerWithTitle:@"Error" message:@"Something Went Wrong" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction _Nonnull action) {
}];
[cont addAction:okAction];
[self presentViewController:cont animated:true completion:nil];
}
else if (result.isCancelled)
{
//Permission Canceled
}
else
{
//User Accept Permission
NSLog(@"Granded Permissions are %@",result.grantedPermissions);
if ([FBSDKAccessToken currentAccessToken])
{
[[[FBSDKGraphRequest alloc]initWithGraphPath:@"me" parameters:nil]startWithCompletionHandler:^(FBSDKGraphRequestConnection connection, id result, NSError error) {
NSLog(@"Value of Error is %@",error);
NSLog(@"Value of Result is %@",result);
if (error == nil)
{
//
[[[FBSDKGraphRequest alloc]initWithGraphPath:@"me" parameters:@{@"fields": @"picture.width(500).height(500),first_name,email,last_name,location,gender,likes,interested_in"}]startWithCompletionHandler:^(FBSDKGraphRequestConnection connection, id result, NSError error) {
NSLog(@"Value of Result is %@",result);
NSLog(@"Value of Error is %@",error);
if ( error != nil)
{
// NSMutableDictionary *tempDict = [[NSMutableDictionary alloc]init];
// myPagesArray = [[result valueForKey:@"likes"]valueForKey:@"data"];
}
}];
}
else
{
//Something Went Wrong...
}
}];
}
}
}];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
在我的应用程序中,脸书和谷歌在iOS 10中也无法登录。所以我在钥匙链分享上做了点东西,而且很有效。
看看这个:https://stackoverflow.com/a/39568942/3901620
我正在尝试使用解析SDK进行Facebook的单点登录,但是当我按下登录按钮时,我收到此错误: 哦哦。出现错误:错误域=com.facebook。sdk Code=2“操作无法完成。(com.facebook.sdk error 2.)”UserInfo=0x1d5bac20{com.facebook.sdk:ErrorLoginFailedReason=com.facebok.sdk:Syste
问题内容: 在Xcode8 beta6中,以下代码将引发警告:’is’测试始终为true。但是它不会打印通行证。 并且以下代码将引发警告:从“ T”到“ AnyObject”的条件强制转换始终成功 问题答案: 该警告按预期起作用: 但是,返回不 此答案的先前版本认为有警告, ‘是’测试总是正确的 作为错误,并讨论了为什么会出现这种错误的警告。但是,在运行时评估为,这被认为是预期的行为。 给定OP(
本文向大家介绍Xcode8、iOS10升级问题记录,包括了Xcode8、iOS10升级问题记录的使用技巧和注意事项,需要的朋友参考一下 1、webView的代理方法: 升级前: - (void)webView:(UIWebView *)webView didFailLoadWithError:(nullable NSError *)error 升级后: - (void)webView:(U
1. 申请应用 1.1 创建第三方授权应用 登录 Facebook 开发者中心:Facebook 开发者中心 (opens new window) 进入“我的应用”管理页面 点击“添加新应用”,在弹窗中选择“用于其他用途” 按照提示,创建应用编号 在应用详情页面,选择“Facebook 登录” 配置“Facebook 登录”的回调地址 获取Client ID和Client Secret 点击左侧菜
拉威尔6。PHP7.4。 我正在建立一个网站。因为Laravel提供了默认的身份验证登录和注册表单。我将登录表单放入导航中,而注册页面上的注册表单。现在我想让用户在注册页面上提供另一个登录表单。 我设计了另一个登录表单,在提交时,我将其引用到相同的登录路径,但它不起作用。错误是419页已过期。 我也读过关于MutiAuth的文章,但这是我将在我的管理面板上使用的东西。有什么解决办法吗? Regis
我在magento 1.9中使用了fishpig扩展,我在magento中面临自动登录错误消息: WordPress自动登录失败:HTTP/1.1 200 OK服务器:NGINX/1.0.15日期:周二,2015年12月8日20:20:02 GMT内容-类型:text/html;Charset=UTF-8连接:keep-alive X-Power-by:php/5.4.25过期:Wed,1984年