How to import FacebookSDK in Header file of Swift iOS application
I am converting my application from Objective- C to swift . In my swift application I have created a header file as explained in following tutorial , but i am getting error ‘FacebookSDK/FacebookSDK.h’ file not found rather than I imported facebookSDK successfully in my application . Please guid me how to import facebookSDK in swift.
3 Solutions Collect From Internet About “How to import FacebookSDK in Header file of Swift iOS application”
Facebook supports swift natively as of SDK v4.1, so bridging headers are not required now. (by the way, they also deprecated
FacebookSDK in favor of
FBSDKCoreKit since this version)
Just import the module you need directly:
import FBSDKCoreKit import FBSDKShareKit import FBSDKLoginKit
Here is a simple way to do it right:
- Create a Swift project
- File > New > Cocoa Touch Class > Language Objective-C > Create
- Xcode asks you to create a bridging header, let Xcode create that header
- Do the steps in: http://www.brianjcoleman.com/tutorial-facebook-login-in-swift/
#import <FacebookSDK/FacebookSDK.h>to the Xcode generated bridging header.
You need to add it to your target’s build settings:
1.In Xcode, if you go into the build settings for your target, and scroll all the way down you’ll find a “Swift Compiler – Code Generation” section.
2.Set “Objective-C Bridging Header” to <#PROJECT_NAME>Bridging-Header.h
3.Now create a Bridging-Header.h file.Import FacebookSDK/FacebookSDK.h to Bridging-Header.h.
This worked for me.Hope will work for u too 🙂
- How to record video with overlay view
- How to make a countdown with NSTimer on Swift
- Local and Global variables in Swift
- Where does Xcode save the program's executable files or equivalent files?
- UIButton: Making the hit area larger than the default hit area
- Capitalise first letter of every sentence
- Storyboard weird controller view frame origins
- Frame is not changing in cellForRowAtIndexPath
- iPhone – Differences among time zone convenience methods
- Add static library to podspec
- No such module 'FBSDKCoreKit' XCODE 7.4
- How to replace Objective-C 2.0 class method implementation in runtime
- Adding action and target to a custom Navigation BarButtonItem?
- How do I set the accesibility label for a particular segment of a UISegmentedControl?
- Simplest way to evenly distribute UIButtons horizontally across width of view controller?