facebookarchive / facebook-swift-sdk Goto Github PK
View Code? Open in Web Editor NEWIntegrate your iOS apps in Swift with Facebook Platform.
Home Page: https://developers.facebook.com/docs/swift
License: Other
Integrate your iOS apps in Swift with Facebook Platform.
Home Page: https://developers.facebook.com/docs/swift
License: Other
Hi, I have error:
Module compiled with Swift 2.3 cannot be imported in Swift 3.0
I tried to do carthage update
, but it did not help me.
And set Use Legacy Swift Language Version
to YES
, did not help me too.
Use:
Xcode 8, Swift 3
My Cartfile:
github "stephencelis/SQLite.swift"
github "facebook/Facebook-SDK-Swift"
$ carthage update --platform iOS
*** Fetching Facebook-SDK-Swift
*** Fetching SQLite.swift
*** Fetching facebook-ios-sdk
*** Fetching Bolts-ObjC
*** Checking out Bolts-ObjC at "1.8.4"
*** Checking out SQLite.swift at "0.10.1"
*** Downloading facebook-ios-sdk.framework binary at "4.14.0"
*** Checking out facebook-ios-sdk at "sdk-version-4.14.0"
*** Checking out Facebook-SDK-Swift at "0.1.1"
*** xcodebuild output can be found in /var/folders/8d/6t4zhl296lx7_1nlg7qt5_j40000gn/T/carthage-xcodebuild.TLApZH.log
*** Building scheme "Bolts-iOS-Dynamic" in Bolts.xcodeproj
*** Building scheme "SQLite iOS" in SQLite.xcodeproj
Terminal stopped here, I'd wait at least an hour but not finished.
I watched the log file, as stdout print, only Bolts-iOS-Dynamic and SQLite iOS build success info in the file.
Before I add Facebook-SDK-Swift, it was worked.
Hi how can i load Facebook Login Button to my UIButton.. before i just change the UIButton class to FBSDKLoginButton... is it the same in swift or its pending? i tried my own customise UIButton view but its a mess with my Layout so , changing class for me is better. Maybe you could give me just a small solution. Adding to subview has a problem on width and height with layout frames in my UI.
I have integrated latest Swift SDK with my app. When I click on Login button,I can able to navigate to safari browser and after successful login and confirm page, login button delegates called with cancelled status. What could be the issue?
Also, I can able to return back to my app only on iOS versions < 9.0 and on versions iOS 9.0+ I can't able to return back to my application.
Error when trying to display the share dialog
"// Create an object
let object: OpenGraphObject = [
"og:type": "books.book",
"og:title": "A Game of Thrones",
"og:description": "In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.",
"books:isbn": "0-553-57340-3"
]
// Create an action
var action = OpenGraphAction(type: "book.reads")
action["books:book"] = object
// Create the content
var content = OpenGraphShareContent()
content.action = action
content.previewPropertyName = "books:book"
try ShareDialog.show(from: self, content: content) "
Cannot invoke 'show' with an argument list of type '(from: UIViewController, content: OpenGraphShareContent)'
This works when running in iOS9.3 simulator, but not in iOS10.
Every time I attempt to login using the login button, I get an error message of:
The operation couldn’t be completed. (com.facebook.sdk.login error 308.)
Sample code below:
class SignInViewController: UIViewController, LoginButtonDelegate {
var fbLoginButton: LoginButton!
override func viewDidLoad() {
super.viewDidLoad()
fbLoginButton = LoginButton(readPermissions: [.Email, .PublicProfile])
fbLoginButton.delegate = self
}
func loginButtonDidCompleteLogin(loginButton: LoginButton, result: LoginResult) {
switch result {
case .Failed(let error):
// User log in failed with error
case .Cancelled:
// User cancelled login
case .Success:
// Log in user
}
}
func loginButtonDidLogOut(loginButton: LoginButton) {
// Do some logout stuff
}
}
Hi,
I have successfully installed facebook sdk using carthage. I then linked facebook sdk to my created framework. When I try to build my project, it works fine but when I try to build my project with a module on my framework that imports FacebookShare it will show this compile-time error.
ld: framework not found FBSDKShareKit for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Below is my current project where the fbservice.xcodeproj is my framework
Any help?
LoginButton
AccessToken.current
AccessToken.refreshCurrentToken:completion
Optional(Error Domain=com.facebook.sdk.core Code=10 "(null)" UserInfo={com.facebook.sdk:FBSDKErrorDeveloperMessageKey=No current access token to refresh})
Both AccessToken.current
and AccessToken.refreshCurrentToken:completion
should return an access token, according to the docs
Why is AccessToken.userId
an Optional? Under what circumstances would I encounter nil
for this field? What makes userId
Optional and authenticationToken
non-Optional?
From the SDK consumer's perspective, an access token without an associated user seems like a degenerate case, perhaps an error, as degenerate as an AccessToken
with authenticationToken == nil
, if that were possible. I'm not sure what an appropriate response/handling would be.
Nullability auditing of the wrapped SDKs seems to be a large challenge to a project like this, and now would be a good time to say that I really appreciate all the efforts here.
Is FBSDKShareVideo provide Caption for posting video. ??
Used following code
let shareVdo: FBSDKShareVideo = FBSDKShareVideo()
shareVdo.videoURL = videoURL!
let vdoContent = FBSDKShareVideoContent()
vdoContent.video = shareVdo
FBSDKShareAPI.shareWithContent(vdoContent, delegate: self)
FBSDKGraphRequest(graphPath: "me/videos", parameters: ["fields": "id, name, first_name, last_name, picture.type(large), email"]).startWithCompletionHandler({ (connection, result, error) -> Void in
//
I can't use the pod with xcode 8 (beta 6) I guess it's because the code hasn't been ported to swift3. Do you have an idea of when we can expect an update on that front?
I've been searching low and high to find an answer for this issue and I've already changed my Allow non-modular setting to yes. I'm still not sure why my project won't build when installing Facebook SDK via cocoapods I'm using Xcode 9.3.1
I did try the new released Facebook SDK for Swift Github, added but after
pod 'FacebookCore'
But after
pod install
I get a error, see attached image
Are there more steps needed?
I have an issue where the success response does not give me back the JSON format i was expecting..
class FacebookLoginHelper {
class func login(controller:UIViewController, successBlock: @escaping ( _ status:Bool, _ response:JSON?, _ token:String?, _ id:String?) -> Void) {
let loginManager = LoginManager()
let readPermissions: [ReadPermission] = [.publicProfile, .email, .userFriends]
loginManager.logIn(readPermissions, viewController: controller) { loginResult in
switch loginResult {
case .failed(let error):
print("failed", error)
successBlock(false, nil, nil,nil)
return
case .cancelled:
successBlock(false, nil , nil,nil)
case .success(let grantedPermissions, let declinedPermissions, let accessToken):
let connection = GraphRequestConnection()
var request = GraphRequest.init(graphPath: "me")
request.parameters = ["fields":"email,first_name,last_name,picture.width(1000).height(1000),birthday,gender"]
connection.add(request, completion: {
(response, result) in
print("Facebook graph Result:", result)
let json = JSON(result)
print("Facebook graph Result:", json)
let id = json["id"].string
successBlock(true, json, accessToken.authenticationToken ,id)
})
connection.start()
}
}
}
}
THE OUTPUT:
success(FacebookCore.GraphResponse(rawResponse: Optional({
email = "[email protected]";
"first_name" = test;
gender = male;
id = 1234556788900;
"last_name" = test;
picture = {
data = {
height = 1224;
"is_silhouette" = 0;
url = "test.jpg";
width = 1224;
};
};
})))
I think version 4.14 (CoreKit and LoginKit) are missing the $(CURRENT_PROJECT_VERSION)
which gets set as CFBundleVersion
in the Info.plist. I can confirm that the FBSDKCoreKit.framework
in my local Carthage/Build folder is missing this key in the info.plist
Hi, I tried to use Facebook API following steps in the file. But when I got to 'pod install', it showed
Analyzing dependencies
[!] Unable to find a specification for FacebookCore
Could anyone tell me how to solve it?
source 'https://github.com/CocoaPods/Specs.git'
target 'Test' do
use_frameworks!
pod 'Alamofire', '~> 3.0'
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |configuration|
configuration.build_settings['SWIFT_VERSION'] = "2.3"
end
end
end
When swift 3 support will be released?
Is it possible to use current facebook-sdk-swift with swift3 project?
Hi. I'm working on an iOS 10 turn based game where I need to make game requests. I can't find a way to make a game request work in Swift 3 due to lack of documentation. Anyone who can help?
I have the userID for the person who it should be sent to but that's about i.
When running "Carthage update", the following is shown
xcodebuild timed out while trying to read FBSDKIntegrationTests.xcodeproj 😭
Documentation says to use something like: let content = OpenGraphShareContent(). But that results in the error: 'OpenGraphShareContent' cannot be constructed because it has no accessible initializers.
2016-08-23 16:37:38.115 FBLoginSwift[1505:1087947] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x100992750>) of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'
*** First throw call stack:
(0x18234adb0 0x1819aff80 0x187ded268 0x187801fb0 0x1878000c8 0x1877530c8 0x187760a80 0x1874925a4 0x182300728 0x1822fe4cc 0x1822fe8fc 0x182228c50 0x183b10088 0x18750a088 0x100006294 0x181dc68b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
i just want to retrieve all the friend's birthday date and email using facebook sdk in ios but i can only retrieve friends : id , frist_name , last_name, name , picture but birthday can not.
please help me , it's so urgent as soon as possible.
My project not compiling CocoaPod FacebookCore. And when cloning project, break and other libraries. My project on Swift 3 and this lib on 2.3, swift legacy is true.
http://i.stack.imgur.com/px2Zz.jpg
I'm using the new facebook graph request:
let parameters = ["fields": "id, name, gender"]
let nextrequest: GraphRequest = GraphRequest(graphPath: "me", parameters: parameters, accessToken: AccessToken.current, httpMethod: .GET)
nextrequest.start({ (response: HTTPURLResponse?, result: GraphRequestResult<GraphRequest>) in
// }) { (connection: GraphRequestConnection! , result: AnyObject!, error: NSError!) -> Void in
print(result as [Any])
})
I'm having a hard time parsing it I get this error:
Cannot convert value of type 'GraphRequestResult' to type '[Any]' in coercion
How can I access the values gender, id and name
success(FacebookCore.GraphResponse(rawResponse: Optional({
gender = male;
id = 1128614937219535;
name = "Rayan Slim";
})))
After the login and the permission agreement the web view is blank and the only button is "Done" which close and cancel the login. I followed the developer guide.
see update 1
see last update (2)
Found: Application delegate haven't the correct "openURL" methods..
The guide is incorrect when they don't say you have to write those two rows..
But what is the native library "AppDelegate"?
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(app, openURL: url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey])
}
The first problem (White screen) was solved by adding the application delegate method (Not mentioned in the guide)
The second problem is that with FBSDKApplicationDelegate works.. but with ApplicationDelegate
(or if used into the ios application manager FacebookCore.ApplicationDelegate
) the application crash because UIApplicationOpenURLOptionsAnnotation
is nil.
The problem of the white web screen after accepting the permission agreement was solved adding the facebook app delegate.
The second problem of the applicationDelegate method has been solved by replacing the FBSDKApplicationDelegate
in functions
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(app, openURL: url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey])
}
with FacebookCore.ApplicationDelegate
(that I hope it will be named FBApplicationDelegate) as it follow
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
return FacebookCore.ApplicationDelegate.shared.application(app, openURL: url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey] ?? [])
}
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FacebookCore.ApplicationDelegate.shared.application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
Note the
?? []
:
DO NOT USE!
Thanks to @nlutsenko 👍
I apologise in advance if this is a newbie error but while trying to follow the install instructions with Cocoapods 1.0.1:
Podfile:
platform :ios, '10.0'
target 'App' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
end
I'm running
pod install
Installing Bolts (1.8.4)
Installing FBSDKCoreKit (4.15.1)
Installing FBSDKLoginKit (4.15.1)
Installing FBSDKShareKit (4.15.1)
Installing FacebookCore (0.2.0)
Installing FacebookLogin (0.2.0)
Installing FacebookShare (0.2.0)
It then tells me to open MeetApp.xcworkspace from now on, which I do.
But then Xcode asks if I want to covert Pods to Swift 3 or 2.3 as it can't compile FacebookCore. Some example errors (out of 84 of them):
AppEventName.swift: Use of undeclared type 'ExpressibleByStringLiteral'
UserProfile.swift: Unknown attribute 'escaping'
All the .framework file becomes red and I'm failing to import them into my project.
I wonder if this lib is safe to use for production since it says (beta)
i set app delegate custom navbar to use pattern image.
UINavigationBar.appearance().barTintColor = UIColor(patternImage: UIImage(named: "tileNavBar.png")!)
then when you tap facebook login button, it will return error.
A fixed would change the color to use RGB values.
the podspecs apparently haven't been uploaded.
I am having trouble to get the Facebook Login component to resolve while using the following environment:
Swift 3.0 in Xcode 8 Facebook SDK for Swift (0.2.0) Running on iOS 10
I've followed all the required steps to get it going (iOS Getting Started and Swift Getting Started), even the steps not mentioned in here such as adding the default AppDelegate methods as follow:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FacebookCore.SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: [
.sourceApplication: application,
])
return true
}
private func application(app: UIApplication, openURL url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
return FacebookCore.SDKApplicationDelegate.shared.application(app, open: url, options: [
.sourceApplication: app,
])
}
@available(iOS 9.0, *)
private func application(application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FacebookCore.SDKApplicationDelegate.shared.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
}
As for the Info.plist contents, concerning the Facebook part, I assume I have all the required tags and even some others that seemed helpful to resolve the situation, found in some questions on SO and issues on Github:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1619016601757957</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>1619016601757957</string>
<key>FacebookDisplayName</key>
<string>Nossa Cidade</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
</dict>
</dict>
</dict>
For the last and core part, super simplified, I attach the login button logic in my login controller.
override func viewDidLoad() {
super.viewDidLoad()
loginButton = LoginButton(readPermissions: [.publicProfile, .userFriends, .email])
loginButton.center = view.center
loginButton.frame.origin = CGPoint(x: loginButton.frame.origin.x,y: loginBtn.frame.origin.y + 80)
self.view.addSubview(loginButton)
loginButton.delegate = self
}
func loginButtonDidCompleteLogin(_ loginButton: LoginButton, result: LoginResult) {
switch result {
case .success(let grantedPermissions, _, let accessToken):
print("facebook success")
print(accessToken.authenticationToken)
break
case .cancelled:
print("facebook cancelled")
break
case .failed(let error):
print("facebook error")
break
}
}
func loginButtonDidLogOut(_ loginButton: LoginButton) {
print("User has logged out")
}
I've gone through a lot of SO questions, Github issues, and there are some developers running into the same situation as me, without any concrete response about the possible outcome of this error. What happens in the end, is that I get a big fat LoginResult.cancelled callback, not what I intend.
The output from the console, related to this is:
-canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
Any help would be appreciated. Thank you!
I have added Facebook sdk from cocoapods. Below are the line in my pod file.
My environment : Xcode 8, iOS 10, Swift 3.
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
I implemented following delegate methods.
public func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool
public func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool
I called login with .systemAccount behaviour. Below is the code snippet
let loginManager = LoginManager()
loginManager.loginBehavior = LoginBehavior.systemAccount//FBSDKLoginBehavior.systemAccount
loginManager.logIn([.publicProfile], viewController: self) {
If System account in iPhone is logged in, its working fine. But when it is not logged In, blank screen appears and it goes no where. I uploaded the image of blank screen.
Hi,
I have successfully installed the Facebook SDK via cocoapods, however once the simulator is up and running, I receive this error:
dyld: Library not loaded: @rpath/FBSDKLoginKit.framework/FBSDKLoginKit
Referenced from: /Users/development/Library/Developer/CoreSimulator/Devices/CFD9201A-7745-42C1-AACC-66422917F80D/data/Containers/Bundle/Application/07DA2FF2-144A-4556-8D94-A9AA179AA52E/test.app/test
Reason: image not found
I have cleared down all files that are in Devices and closed Xcode but this keeps appearing.
It also breaks on this:
dyld_sim`dyld_fatal_error:
0x104237000 <+0>: int3
-> 0x104237001 <+1>: nop
Hi, I am trying to use Carthage update
to get all the Facebook frameworks.
When carthage is done I can see the following framworks in Carthage/Build/iOS
Bolts.framework
FacebookCore.framework
FacebookLogin.framework
FacebookShare.framework
But not the
FBSDKCoreKit.framework
Carthage version 0.17.2
Logs:
Lindas-MacBook-Pro:External linda$ brew upgrade carthage
Error: carthage 0.17.2 already installed
Lindas-MacBook-Pro:External linda$ Carthage update
*** Fetching facebook-sdk-swift
*** Fetching facebook-ios-sdk
*** Fetching Bolts-ObjC
*** Checking out Bolts-ObjC at "1.8.4"
*** Checking out facebook-sdk-swift at "0.1.1"
*** Downloading facebook-ios-sdk.framework binary at "4.15.0"
*** Checking out facebook-ios-sdk at "sdk-version-4.15.0"
*** xcodebuild output can be found in /var/folders/px/6h8vf5gd2vbgfz716vll12h80000gp/T/carthage-xcodebuild.xeASTg.log
*** Building scheme "Bolts-macOS" in Bolts.xcodeproj
*** Building scheme "Bolts-tvOS-Dynamic" in Bolts.xcodeproj
*** Building scheme "Bolts-watchOS-Dynamic" in Bolts.xcodeproj
*** Building scheme "Bolts-iOS-Dynamic" in Bolts.xcodeproj
*** Building scheme "Bolts-tvOS-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "Bolts-watchOS-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "Bolts-macOS" in FacebookSDK.xcworkspace
*** Building scheme "Bolts-iOS-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "FacebookLogin" in FacebookSwift.xcworkspace
*** Building scheme "FacebookCore" in FacebookSwift.xcworkspace
*** Building scheme "FacebookShare" in FacebookSwift.xcworkspace
The library is not compiling with Swift 3.0 project using XCode 8.0 beta 6, getting errors like the following:
../Pods/FacebookCore/Sources/Core/GraphRequest/GraphRequestConnection.swift:33:46: Function types cannot have argument label 'bytesSent'; use '_' instead
Is there plans to support Swift 3.0 soon?
I would like to set some user properties.
I have seen it in https://developers.facebook.com/docs/analytics/properties How can I use it?
if let accessToken = AccessToken.current {
print(accessToken)
} else {
let loginManager = LoginManager()
let completion = {
(result:LoginResult) in
switch result {
case .Success(let grantedPermissions, let declinedPermissions, let accessToken):
print("YES! \n--- GRANTED PERMISSIONS ---\n\(grantedPermissions) \n--- DECLINED PERMISSIONS ---\n\(declinedPermissions) \n--- ACCESS TOKEN ---\n\(accessToken)")
case .Failed(let error):
print("No...\(error)")
case .Cancelled:
print("Fine.")
}
}
loginManager.logIn([.PublishActions], viewController: self, completion: completion)
}
I'm not sure if this is intentional, but in LoginManager.swift
public func logIn(permissions: [PublishPermission] = [.PublishActions],
viewController: UIViewController? = nil,
completion: ((LoginResult) -> Void)? = nil) {
let sdkPermissions = permissions.map({ $0.permissionValue.name })
sdkManager.logInWithReadPermissions(sdkPermissions,
fromViewController: viewController,
handler: LoginManager.sdkCompletionFor(completion))
}
When I'm trying to login with publish permissions, it's wrapping around a logInWithReadPermissions
method. Is this intentional? When logging in with that permission, I get the following exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Publish or manage permissions are not permitted to be requested with read permissions.'
Every time I try to install through CocoaPods, I get the following error:
[!] Unable to find a specification for
FacebookCore``
I'm able to install other (not Facebook) pods through CocoaPods, so that's not the issue.
Is there any tutorial for the new facebook swift sdk?
In order to build with Carthage you need to at a minimum drag in:
FacebookCore.framework
FBSDKCoreKit.framework
Bolts.framework
as well as update the build phase script to include the files:
$(SRCROOT)/Carthage/Build/iOS/Bolts.framework
$(SRCROOT)/Carthage/Build/iOS/FBSDKCoreKit.framework
$(SRCROOT)/Carthage/Build/iOS/FacebookLogin.framework
If you want to include login and/or share, then you need to include those frameworks and add them to the build phase.
Without doing these steps, the project will actually build correctly but you get a nasty "Image not found" crash when the device launches the app
I'm not sure how to replicate the bug yet:
but once in a while when I login with the facebook button. the facebook app opens.
Usually the way it works is that it opens the facebook browser.
Anyways it opens the facebook app, and then goes back to my app without doing anything. And it just keeps doing that over and over... until I delete my app and redownload it.... is anybody else experiencing that # # # #
is there an ETA on a swift3 / xcode8 release? thank you.
I recently migrated my app from Swift 2.3 to 3.0
After that, trying to login to facebook results in blank Safari screen after confirming the app permissions. There are no errors in the console and the logIn completion handler does not fire.
If I tap Done the completion handler fires with cancelled.
This happens both on device (10.0.1) & simulator (9.3, 10.0.1)
If I use web LoginBehavior, it works fine - after confirming permissions the completion handler fires.
This also happens with the older Obj-C SDK. Actually, I finally migrated to the Swift sdk, hoping that it will fix it.
This seems similar to #66 and #67
I tried adjusting transport security, but that didn't work and I am not using the AppDelegate url method.
error msg
Graph Request Failed: Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Unknown path components: /me, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=2500, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 2500;
"fbtrace_id" = Hp7qC970khA;
message = "Unknown path components: /me";
type = OAuthException;
};
};
code = 400;
}}
my code
struct FBProfileRequest: GraphRequestProtocol {
struct Response: GraphResponseProtocol {
init(rawResponse: AnyObject?) {
print("rawResponse: \(rawResponse)")
}
}
var graphPath: String = "me"
var parameters: [String : AnyObject]? = ["fields": "id, name"]
var accessToken: AccessToken? = AccessToken.current!
var httpMethod: GraphRequestHTTPMethod = .GET
var apiVersion: String = "2.7"
}
class GigLogInViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let FBLoginBtn = LoginButton(readPermissions: [.PublicProfile, .Email, .UserFriends])
FBLoginBtn.delegate = self
FBLoginBtn.center = view.center
view.addSubview(FBLoginBtn)
if let accessToken = AccessToken.current {
retriFBProfile(accessToken)
}
}
func retriFBProfile(accessToken: AccessToken) {
print("retriFBProfile")
let request = FBProfileRequest()
request.start({ (httpResponse, result) in
print("start completion")
switch result {
case .Success(let response):
print("Graph Request Succeeded: \(response)")
case .Failed(let error):
print("Graph Request Failed: \(error)")
}
})
}
}
extension GigLogInViewController: LoginButtonDelegate {
func loginButtonDidCompleteLogin(loginButton: LoginButton, result: LoginResult) {
switch result {
case .Success:
if let accessToken = AccessToken.current {
retriFBProfile(accessToken)
}
case .Cancelled:
print("cancelled result: \(result)")
case .Failed:
print("failed result: \(result)")
}
}
func loginButtonDidLogOut(loginButton: LoginButton) {
print("did log out FB")
}
}
normal GraphRequest
let request = GraphRequest(graphPath: "/me",
parameters: [ "fields" : "id, name" ],
httpMethod: .GET)
request.start { httpResponse, result in
switch result {
case .Success(let response):
print("Graph Request Succeeded: \(response)")
case .Failed(let error):
print("Graph Request Failed: \(error)")
}
}
success
Graph Request Succeeded: GraphResponse(rawResponse: Optional({
id = 113845862318119;
name = "\U8cf4\U826f\U4efb";
}))
Hi
I am trying to get up and running using carthage.
Bolt is being built just fine, but not the FacebookSDK... I keep getting this error: xcodebuild timed out while trying to read FacebookSwift.xcworkspace
$ carthage update
*** Fetching Facebook-SDK-Swift
*** Fetching facebook-ios-sdk
*** Fetching Bolts-ObjC
*** Checking out Bolts-ObjC at "1.8.4"
*** Downloading facebook-ios-sdk.framework binary at "4.16.1"
*** Checking out facebook-ios-sdk at "sdk-version-4.16.1"
*** Checking out Facebook-SDK-Swift at "0.2.0"
*** xcodebuild output can be found in /var/folders/6v/lqj_5ph13sxdl529hss287l80000gn/T/carthage-xcodebuild.mE1vzx.log
*** Building scheme "Bolts-macOS" in Bolts.xcodeproj
*** Building scheme "Bolts-tvOS-Dynamic" in Bolts.xcodeproj
*** Building scheme "Bolts-watchOS-Dynamic" in Bolts.xcodeproj
*** Building scheme "Bolts-iOS-Dynamic" in Bolts.xcodeproj
*** Building scheme "FBSDKCoreKit_TV-Dynamic" in FacebookSDK.xcworkspace
xcodebuild timed out while trying to read FacebookSwift.xcworkspace
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.