我的应用登录页面上有一个Facebook登录按钮。登录的Web视图部分顺利进行,但它所做的只是将Facebook按钮标题更改为function f=ofun(x)
%Define variables and constants- when you define e_t, why are you not multiplying dt elementwise? Also why do you transpose matrix t?
Kp = x(1); Ki = x(2); d = 0.001; I_ref = [-1.1 : d : 1]; dt = 0.01; t = [0 : dt : 1]; e_t = I_ref - (Kp.*e_t + Ki.*sum(t'.*abs(e_t)*dt));
f = sum(t'.*abs(e_t)*dt);% line 10
end
,而不是继续呈现下一个视图控制器。
这是日志:
"Log Out"
这是我用来登录Facebook的代码:
Attempt to present <ViewController: 0x7fce11c29450> on <SFAuthenticationViewController: 0x7fce13803600> whose view is not in the window hierarchy!
这是func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
self.view.endEditing(true)
let connection = GraphRequestConnection()
connection.add(GraphRequest(graphPath: "/me", parameters: ["fields": "email, id, first_name, last_name, gender, birthday, name, picture.width(480).height(480)"])) { httpResponse, result in
switch result {
case .success(let response):
if let resultDictionary = response.dictionaryValue {
AuthService.sharedInstance.loginFacebookUser(userDetails: resultDictionary as NSDictionary, completion: { (result) in
if result == "Success" {
self.goToMovies()
} else {
self.alert(result)
}
})
} else {
self.alert("There was an error logging in with Facebook. Please try again.")
}
case .failed:
self.alert("There was an error logging in with Facebook. Please try again.")
}
}
connection.start()
}
的实现,我实例化我想要呈现的视图控制器的函数:
goToMovies()