简体   繁体   中英

How to install facebook sdk for iOS using cocoapods?

In the facebook's documentation: Here: https://developers.facebook.com/docs/ios/getting-started

It's written that we could use:

pod \'Facebook-iOS-SDK\'

For installing pods in our project. But I added it in the pod file at line 10 and try to run pod install, it shows following error on terminal:

[!] Oh no, an error occurred.

It appears to have originated from your Podfile at line 10.

Search for existing github issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%2FUsers%2Fprajeetshrestha%2FDesktop%2FHotRents%2FPodfile%3A10%3A+syntax+error%2C+unexpected+%24undefined%0A++++pod+%5C%27%2FUsers%2Fprajeetshrestha%2FDeskt...%0A+++++++++%5E%0A%2FUsers%2Fprajeetshrestha%2FDesktop%2FHotRents%2FPodfile%3A13%3A+syntax+error%2C+unexpected+tCONSTANT%2C+expecting+keyword_end%0Atarget+%27HotRentsTests%27+do%0A+++++++++++++++++++++%5E%0A%2FUsers%2Fprajeetshrestha%2FDesktop%2FHotRents%2FPodfile%3A13%3A+unterminated+string+meets+end+of+file%0A%2FUsers%2Fprajeetshrestha%2FDesktop%2FHotRents%2FPodfile%3A13%3A+syntax+error%2C+unexpected+end-of-input%2C+expecting+keyword_end&type=Issues

If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new

Facebook-iOS-SDK has been deprecated (see the message cocoapods give you when you use pod install ).

According to Facebook You should use:

pod "FBSDKCoreKit";
pod "FBSDKLoginKit";
pod "FBSDKShareKit";
pod "FBSDKMessengerShareKit";

Changing the pod link to

pod "Facebook-iOS-SDK"

solved it why do they put \\' in documentation is the question now?

EDIT : This answer is now outdated . The correct way to install facebook Pod is as @aramusss described above.

You can implement the frameworks in the Facebook SDK for iOS by adding the framework project files to your project workspace and then building your project. Adding the project files to your workspace is a way to use the Facebook SDK if you have trouble using Swift Package Manager or CocoaPods.

Before You Start This procedure assumes you are using the latest version of iOS and xCode .

You will need:

A Facebook Developer Account

An App ID for your app

Set Up Your Development Environment

  1. In Xcode, click File > Swift Packages > Add Package Dependency .
  2. In the dialog that appears, enter the repository URL: https://github.com/facebook/facebook-ios-sdk . 在此处输入图片说明
  3. In Version , select Up to Next Major and the default option. 在此处输入图片说明
  4. Complete the prompts to select the libraries you want to use in your project.

For more info, see https://developers.facebook.com/docs/ios/implement-sdk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM