Skip to content

Instantly share code, notes, and snippets.

@gorhack
Last active December 26, 2015 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gorhack/7d8ff0c39903dd6f750e to your computer and use it in GitHub Desktop.
Save gorhack/7d8ff0c39903dd6f750e to your computer and use it in GitHub Desktop.
File additions to implement Facebook SDK with Swift 2
import FBSDKShareKit
...
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(
application,
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation)
}
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb859573284156564</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>859573284156564</string>
<key>FacebookDisplayName</key>
<string>login example</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
import FBSDKLoginKit
...
override func viewDidLoad() {
super.viewDidLoad()
let loginButton = FBSDKLoginButton.init()
loginButton.center = self.view.center
self.view.addSubview(loginButton)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment