OBJ -C- Facebook iOS SDK仅适用于Swift?
我正在尝试将Facebook iOS SDK安装在我的OBJ-C项目中,但是似乎Facebooksdk现在仅用Swift编写?任何人都有关于如何将Facebook SDK与我的OBJ-C项目集成的想法或技巧?通过Cocoapods安装。
帮助您表示赞赏!
I'm trying to install the Facebook iOS SDK in my Obj-C project, but it appears as though the FacebookSDK is only written in Swift now? Anyone have any ideas or tips on how I can integrate the Facebook SDK with my Obj-C project? Installing via CocoaPods.
Help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您仍然可以在您的Objective-C项目中使用Facebook iOS SDK,即使它主要用Swift编写。我建议使用 Swift软件包管理器(SPM)进行集成,因为可拒绝可可录。以下是这样做的方法:
通过Swift Package Manager 添加Facebook SDK:
file>添加软件包...
。fbsdkcorekit
和fbsdkloginkit
。设置一个桥接标题:
在Objective-C 中使用Facebook SDK:
例如,在您的
appdelegate.m
中:在
didfinishlaunchingwithoptions:启动器];
另外,如果您愿意,您仍然可以使用 cocoapods ,但它是弃用的。将
pod'facebooksdk'
添加到您的podfile
并运行pod install
。但是,我建议使用SPM进行长期支持。此响应在提供两个选项的同时更直接地解决了问题。
You can still use the Facebook iOS SDK in your Objective-C project, even though it’s primarily written in Swift now. I recommend using Swift Package Manager (SPM) for the integration, as CocoaPods is deprecated. Here’s how to do it:
Add Facebook SDK via Swift Package Manager:
File > Add Packages...
.FBSDKCoreKit
andFBSDKLoginKit
.Set up a Bridging Header:
Use Facebook SDK in Objective-C:
In your
AppDelegate.m
, for example:Alternatively, you can still use CocoaPods if you prefer, but it's deprecated. Add
pod 'FacebookSDK'
to yourPodfile
and runpod install
. However, I recommend using SPM for long-term support.This response addresses the question more directly while providing both options.