【发布时间】:2014-06-25 18:51:58
【问题描述】:
我不断收到此错误:
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)
Command /Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 254
我正在尝试做的事情: 用脸书登录。我有用于登录的目标 C 代码(来自他们的示例项目),但我使用的是 Swift,因为我不知道目标 C。
如何从 swift 调用目标 C 方法?
这是我的目标 C 代码:
// If the session state is any of the two "open" states when the button is clicked
if (FBSession.activeSession.state == FBSessionStateOpen
|| FBSession.activeSession.state == FBSessionStateOpenTokenExtended) {
// Close the session and remove the access token from the cache
// The session state handler (in the app delegate) will be called automatically
[FBSession.activeSession closeAndClearTokenInformation];
// If the session state is not any of the two "open" states when the button is clicked
} else {
// Open a session showing the user the login UI
// You must ALWAYS ask for public_profile permissions when opening a session
[FBSession openActiveSessionWithReadPermissions:@[@"public_profile"]
allowLoginUI:YES
completionHandler:
^(FBSession *session, FBSessionState state, NSError *error) {
// Retrieve the app delegate
AppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
// Call the app delegate's sessionStateChanged:state:error method to handle session state changes
[appDelegate sessionStateChanged:session state:state error:error];
}];
}
还有我的快速代码:
var bridgeForFacebook: Bridge = Bridge()
@IBAction func fbSubmit(sender: AnyObject) {
bridgeForFacebook.signIn();
}
【问题讨论】:
标签: objective-c xcode facebook swift