xcode beta 3 swift and FBLoginViewDelegate

旧时模样 提交于 2019-12-09 21:06:56

问题


with the new release of xcode (beta 3) the class I implemented to handle facebook login in facebook doesn't work anymore. it failed to use FBLoginViewDelegate where before it worked. this happens when I use to extends a class:

class LoginVC: MyViewController,MyDetailUsable,FBLoginViewDelegate

I installed last facebook sdk, Just in case I forgot something, this are my settings defined for the project:

MyConnection/MyConnection-Bridging-Header.h  : #import <FacebookSDK/FacebookSDK.h>

//:configuration = Debug
SWIFT_OBJC_BRIDGING_HEADER = MyConnection/MyConnection-Bridging-Header.h

//:configuration = Release
SWIFT_OBJC_BRIDGING_HEADER = MyConnection/MyConnection-Bridging-Header.h

//:completeSettings = some
SWIFT_INSTALL_OBJC_HEADER = YES
//:configuration = Debug
CLANG_ENABLE_MODULES = YES
//:configuration = Release
CLANG_ENABLE_MODULES = YES
//:completeSettings = some
CLANG_ENABLE_MODULES = YES

do you have any suggestion to avoid or solve this issue?


回答1:


Facebook SDK has a protocol named FBGraphObject and also a classed named the same. In Swift the namespace of protocols and classes is unified so you can't have conflicting names. For this reason you can't use the precompiled Facebook library.

You need to rename the FBGraphObject protocol to something else like FBGraphObjectProtocol and compile the SDK yourself. This conflict will also cause SourceKitService most of the times.

I wrote about this on Apple dev forums and someone has forked the Facebook SDK to make the changes. If you're using Cocoapods you can use pod 'Facebook-iOS-SDK', :git => 'https://github.com/pgaspar/facebook-ios-sdk.git' or download the source code yourself and make the changes.



来源:https://stackoverflow.com/questions/24760097/xcode-beta-3-swift-and-fbloginviewdelegate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!