facebook - 'FacebookSDK/FacebookSDK.h' file not found work with Parse -
i working parse , facebook have following 2 errors:
'facebooksdk/facebooksdk.h' file not found
failed import bridging header
i imported both parsefacebookutilsv4/pffacebookutils.h
, parsefacebookutils/pffacebookutils.h
bridging-header because doing swift.
but when used parse working fine, think problem facebooksdk
.
after installed pod file , start project here files:
this app delegate
import uikit
@uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate {
var window: uiwindow? func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. parse.enablelocaldatastore() // initialize parse. parse.setapplicationid(“my_apllication_id”, clientkey: "my_apllication_key") pffacebookutils.initializefacebookwithapplicationlaunchoptions(launchoptions) // [optional] track statistics around application opens. pfanalytics.trackappopenedwithlaunchoptions(launchoptions) return true } func applicationwillresignactive(application: uiapplication) { // sent when application move active inactive state. can occur types of temporary interruptions (such incoming phone call or sms message) or when user quits application , begins transition background state. // use method pause ongoing tasks, disable timers, , throttle down opengl es frame rates. games should use method pause game. } func applicationdidenterbackground(application: uiapplication) { // use method release shared resources, save user data, invalidate timers, , store enough application state information restore application current state in case terminated later. // if application supports background execution, method called instead of applicationwillterminate: when user quits. } func applicationwillenterforeground(application: uiapplication) { // called part of transition background inactive state; here can undo many of changes made on entering background. } func applicationdidbecomeactive(application: uiapplication) { // restart tasks paused (or not yet started) while application inactive. if application in background, optionally refresh user interface. fbsdkappevents.activateapp() } func applicationwillterminate(application: uiapplication) { // called when application terminate. save data if appropriate. see applicationdidenterbackground:. } func application(application: uiapplication, openurl url: nsurl, sourceapplication: string?, annotation: anyobject?) -> bool { return fbsdkapplicationdelegate.sharedinstance().application(application, openurl: url, sourceapplication: sourceapplication, annotation: annotation) }
}
viewcontroller
import uikit
class viewcontroller: uiviewcontroller {
override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. var permissions = ["public_profile"] pffacebookutils.logininbackgroundwithreadpermissions(permissions) { (user: pfuser?, error: nserror?) -> void in if let user = user { if user.isnew { println("user signed , logged in through facebook!") } else { println("user logged in through facebook!") } } else { println("uh oh. user cancelled facebook login.") } } } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. }
}
plist
i added this
<key>cfbundleurltypes</key> <array> <dict> <key>cfbundleurlschemes</key> <array> <string>my_app_key</string> </array> </dict> </array> <key>facebookappid</key> <string>my_app_key</string> <key>facebookdisplayname</key> <string>my_app_name</string>
4 bridging-file
#import "fbsdkcorekit.h" #import "parse.h"
facebook sdk swift integration
it 1 of many steps involved task may have gone wrong. if start on fresh project, find out step missed. follow facebook ios integration tutorial below.
create fresh new xcode project
xcode > file > project... > single view application > next > product name so-32302877
, language swift > next > create.
add pod
in terminal:
cd so-32302877 pod init
and make podfile this:
platform :ios, '8.0' target 'so-32302877' pod 'fbsdkcorekit' end
close xcode project if not done. in terminal, run:
pod install
import sdk
open so-32302877.xcworkspace
. create bridging header. simplest way add & delete obj-c file. in xcode > navigator, select so-32302877
group, xcode > file > new > file... > cocoa touch class > next > class: objc, language: objective-c > next > create.
you can select , delete objc.h
, objc.m
files xcode , move trash. have so-32302877-bridging-header.h
, , target so-32302877
build settings set properly. in so-32302877-bridging-header.h
, add:
#import "fbsdkcorekit.h"
test instrumentation
in swift implementation, invoke:
let token:fbsdkaccesstoken = fbsdkaccesstoken( tokenstring: "tokenstring", permissions: [], declinedpermissions: [], appid: "appid", userid: "userid", expirationdate: nsdate(), refreshdate: nsdate()) print("\(token)")
built, linked, ran & tested on xcode 7 + ios 8.4.
to download full project, search so-32302877 in swift recipes.
Comments
Post a Comment