我一直在努力完成以下程序执行,目前我正在使用Xcode 8和Swift 3 ...它只是一个简单的登录程序,但只要应用程序运行,控制台就会打印错误"无法执行在初始化期间成功更新网络信息"甚至在点击登录按钮之前,解决方案就非常少,而且没有一个能为我工作。
import UIKit
import FBSDKCoreKit
import FBSDKLoginKit
class ViewController: UIViewController, FBSDKLoginButtonDelegate {
@IBOutlet weak var btnButton: FBSDKLoginButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!)
{
if error == nil
{
print("login Successful")
self.configureFacebook()
}
else
{
print("error\(error!)")
}
}
func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!)
{
let loginManager: FBSDKLoginManager = FBSDKLoginManager()
loginManager.logOut()
print("logout successful")
}
func configureFacebook()
{
btnButton.readPermissions = ["public_profile", "email", "user_friends"];
btnButton.delegate = self
}
}