如何使用 Swift 调用 Facebook 代表?Xcode 不自动补全,不知道怎么用.
How can I call the Facebook delegates using Swift? Xcode doesn't autocomplete and I don't know how use it.
import UIKit
class ViewController: UIViewController,FBLoginViewDelegate {
@IBOutlet var fbLoginView : FBLoginView
override func viewDidLoad() {
super.viewDidLoad()
self.fbLoginView.delegate = self
self.fbLoginView.readPermissions = ["public_profile", "email", "user_friends"]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// Facebook Delegates
}
我将给出一个示例翻译并解释它,以便您能够翻译其余的委托方法:
I will give one example translation and explain it so that you should be able to translate the rest of the delegate methods:
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user: (id<FBGraphUser>)user;
FBLoginView!
FBGraphUser
.这给我们留下了这个翻译:
This leaves us with this translation:
func loginViewFetchedUserInto(loginView : FBLoginView!, user: FBGraphUser)
这篇关于在 Swift 中调用 Facebook 代表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!