├── Default-568h@2x.png ├── Frameworks ├── FBSDKCoreKit.framework │ ├── Info.plist │ ├── FBSDKCoreKit │ ├── Modules │ │ └── module.modulemap │ ├── Headers │ │ ├── FBSDKButton.h │ │ ├── FBSDKCopying.h │ │ ├── FBSDKMutableCopying.h │ │ ├── FBSDKCoreKit.h │ │ ├── FBSDKMacros.h │ │ ├── FBSDKGraphRequestDataAttachment.h │ │ ├── FBSDKUtility.h │ │ ├── FBSDKProfilePictureView.h │ │ ├── FBSDKAppLinkUtility.h │ │ ├── FBSDKAppLinkResolver.h │ │ ├── FBSDKApplicationDelegate.h │ │ ├── FBSDKGraphErrorRecoveryProcessor.h │ │ ├── FBSDKTestUsersManager.h │ │ ├── FBSDKGraphRequest.h │ │ ├── FBSDKProfile.h │ │ ├── FBSDKAccessToken.h │ │ ├── FBSDKConstants.h │ │ ├── FBSDKSettings.h │ │ ├── FBSDKGraphRequestConnection.h │ │ └── FBSDKAppEvents.h │ └── PrivateHeaders │ │ ├── FBSDKBridgeAPIProtocolWebV1.h │ │ ├── FBSDKAccessTokenCacheV4.h │ │ ├── FBSDKBridgeAPICrypto.h │ │ ├── FBSDKWebDialogView.h │ │ ├── FBSDKGraphRequestBody.h │ │ ├── FBSDKGraphRequestMetadata.h │ │ ├── FBSDKURLConnection.h │ │ ├── FBSDKBridgeAPIProtocol.h │ │ ├── FBSDKError.h │ │ └── FBSDKBridgeAPIProtocolNativeV1.h └── FBSDKLoginKit.framework │ ├── Info.plist │ ├── FBSDKLoginKit │ ├── Modules │ └── module.modulemap │ └── Headers │ ├── FBSDKLoginKit.h │ ├── FBSDKLoginManagerLoginResult.h │ ├── FBSDKLoginConstants.h │ ├── FBSDKLoginTooltipView.h │ ├── FBSDKLoginButton.h │ ├── FBSDKTooltipView.h │ └── FBSDKLoginManager.h ├── graphics ├── facebook_demo_update_info_plist.png └── load_facebook_profile_ios_swift.png ├── LoadFacebookProfile.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcuserdata │ └── evgenyneu.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── xcshareddata │ └── xcschemes │ ├── LoadFacebookProfile.xcscheme │ └── LoadFacebookProfileKit.xcscheme ├── .gitignore ├── LoadFacebookProfileUITests ├── ViewControllerUITestsTests.swift └── Info.plist ├── LoadFacebookProfileKit ├── TegFacebookUser.swift ├── Info.plist └── FacebookUserLoader.swift ├── LoadFacebookProfileKitTests ├── Info.plist ├── ParseFacebooUserTests.swift └── FakeLoginWithFacebookTests.swift ├── LoadFacebookProfile ├── AppDelegate.swift ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── ViewController.swift ├── Info.plist └── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── LICENSE └── README.md /Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marketplacer/load-facebook-profile-ios-swift/HEAD/Default-568h@2x.png -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marketplacer/load-facebook-profile-ios-swift/HEAD/Frameworks/FBSDKCoreKit.framework/Info.plist -------------------------------------------------------------------------------- /graphics/facebook_demo_update_info_plist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marketplacer/load-facebook-profile-ios-swift/HEAD/graphics/facebook_demo_update_info_plist.png -------------------------------------------------------------------------------- /graphics/load_facebook_profile_ios_swift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marketplacer/load-facebook-profile-ios-swift/HEAD/graphics/load_facebook_profile_ios_swift.png -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marketplacer/load-facebook-profile-ios-swift/HEAD/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marketplacer/load-facebook-profile-ios-swift/HEAD/Frameworks/FBSDKLoginKit.framework/Info.plist -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/FBSDKLoginKit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marketplacer/load-facebook-profile-ios-swift/HEAD/Frameworks/FBSDKLoginKit.framework/FBSDKLoginKit -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module FBSDKLoginKit { 2 | umbrella header "FBSDKLoginKit.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /LoadFacebookProfile.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | ./build 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | profile 15 | *.moved-aside 16 | DerivedData 17 | .idea/ 18 | *.hmap 19 | *.ipa 20 | *.xcuserstate 21 | .DS_Store 22 | Carthage/Checkouts -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module FBSDKCoreKit { 2 | umbrella header "FBSDKCoreKit.h" 3 | 4 | export * 5 | module * { export * } 6 | 7 | explicit module FBSDKButton { 8 | header "FBSDKButton.h" 9 | export * 10 | } 11 | 12 | explicit module FBSDKAppLinkResolver { 13 | header "FBSDKAppLinkResolver.h" 14 | export * 15 | } 16 | 17 | explicit module FBSDKGraphErrorRecoveryProcessor { 18 | header "FBSDKGraphErrorRecoveryProcessor.h" 19 | export * 20 | } 21 | 22 | explicit module FBSDKGraphRequestDataAttachment { 23 | header "FBSDKGraphRequestDataAttachment.h" 24 | export * 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LoadFacebookProfileUITests/ViewControllerUITestsTests.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import XCTest 3 | 4 | class ViewControllerUITestsTests: XCTestCase { 5 | func testAuthenticateWithFacebook() { 6 | self.continueAfterFailure = false 7 | 8 | if #available(iOS 9.0, *) { 9 | let app = XCUIApplication() 10 | app.launchEnvironment["RUNNING_UI_TESTS"] = "YES" 11 | app.launch() 12 | 13 | // Tap on login button 14 | app.buttons["Login with Facebook"].tap() 15 | 16 | // Check if logged in 17 | let predicate = NSPredicate(format: "label CONTAINS 'fake-user-id' AND label CONTAINS 'fake-access-token'") 18 | let userText = app.staticTexts.matchingPredicate(predicate).element 19 | 20 | XCTAssert(userText.exists) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /LoadFacebookProfileKit/TegFacebookUser.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /** 4 | 5 | User profile information returned by the Facebook. Note that it can only guarantee to return id and accessToken fields. All other fields may be empty. 6 | 7 | */ 8 | public struct TegFacebookUser { 9 | public let id: String 10 | public let accessToken: String 11 | public let email: String? 12 | public let firstName: String? 13 | public let lastName: String? 14 | public let name: String? 15 | 16 | public init(id: String, accessToken: String, email: String?, firstName: String?, 17 | lastName: String?, name: String?) { 18 | 19 | self.id = id 20 | self.accessToken = accessToken 21 | self.email = email 22 | self.firstName = firstName 23 | self.lastName = lastName 24 | self.name = name 25 | } 26 | } -------------------------------------------------------------------------------- /LoadFacebookProfileKitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LoadFacebookProfileUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LoadFacebookProfileKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /LoadFacebookProfile/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import FBSDKCoreKit 3 | 4 | @UIApplicationMain 5 | class AppDelegate: UIResponder, UIApplicationDelegate { 6 | 7 | var window: UIWindow? 8 | 9 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 10 | FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) 11 | 12 | return true 13 | } 14 | 15 | func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { 16 | return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) 17 | } 18 | 19 | func applicationDidBecomeActive(application: UIApplication) { 20 | FBSDKAppEvents.activateApp() 21 | } 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /LoadFacebookProfile.xcodeproj/xcuserdata/evgenyneu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SuppressBuildableAutocreation 8 | 9 | 2BD0E5891A8AC1240095C31F 10 | 11 | primary 12 | 13 | 14 | 2BD0E59E1A8AC1240095C31F 15 | 16 | primary 17 | 18 | 19 | 455A113A1B291DFE00BF0266 20 | 21 | primary 22 | 23 | 24 | 45D73BB81B16ADA400D3FE08 25 | 26 | primary 27 | 28 | 29 | 45D73BC21B16ADA400D3FE08 30 | 31 | primary 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2014 The Exchange Group Pty Ltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKButton.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | /*! 22 | @abstract A base class for common SDK buttons. 23 | */ 24 | @interface FBSDKButton : UIButton 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocolWebV1.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import "FBSDKBridgeAPIProtocol.h" 22 | 23 | @interface FBSDKBridgeAPIProtocolWebV1 : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKAccessTokenCacheV4.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import "FBSDKAccessToken.h" 22 | #import "FBSDKAccessTokenCaching.h" 23 | 24 | @interface FBSDKAccessTokenCacheV4 : NSObject 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /LoadFacebookProfile/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/Headers/FBSDKLoginKit.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKCopying.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | /*! 22 | @abstract Extension protocol for NSCopying that adds the copy method, which is implemented on NSObject. 23 | @discussion NSObject implicitly conforms to this protocol. 24 | */ 25 | @protocol FBSDKCopying 26 | 27 | /*! 28 | @abstract Implemented by NSObject as a convenience to copyWithZone:. 29 | @return A copy of the receiver. 30 | */ 31 | - (id)copy; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPICrypto.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import "FBSDKBridgeAPIRequest.h" 22 | 23 | @interface FBSDKBridgeAPICrypto : NSObject 24 | 25 | + (void)addCipherKeyToQueryParameters:(NSMutableDictionary *)queryParameters; 26 | + (NSDictionary *)decryptResponseForRequest:(FBSDKBridgeAPIRequest *)request 27 | queryParameters:(NSDictionary *)queryParameters 28 | error:(NSError *__autoreleasing *)errorRef; 29 | + (void)reset; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKMutableCopying.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | /*! 24 | @abstract Extension protocol for NSMutableCopying that adds the mutableCopy method, which is implemented on NSObject. 25 | @discussion NSObject implicitly conforms to this protocol. 26 | */ 27 | @protocol FBSDKMutableCopying 28 | 29 | /*! 30 | @abstract Implemented by NSObject as a convenience to mutableCopyWithZone:. 31 | @return A mutable copy of the receiver. 32 | */ 33 | - (id)mutableCopy; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /LoadFacebookProfileKitTests/ParseFacebooUserTests.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import XCTest 3 | @testable import LoadFacebookProfileKit 4 | 5 | class FacebookUserParserTests: XCTestCase { 6 | var dictionary: [String: AnyObject]! 7 | 8 | override func setUp() { 9 | super.setUp() 10 | } 11 | 12 | func testParse() { 13 | dictionary = [ 14 | "id": "test-id", 15 | "email": "test-email", 16 | "first_name": "test-first-name", 17 | "last_name": "test-last-name", 18 | "name": "test-name" 19 | ] 20 | 21 | let result = FacebookUserLoader.parseMeData(dictionary, accessToken: "test-access-token")! 22 | XCTAssertEqual("test-id", result.id) 23 | XCTAssertEqual("test-access-token", result.accessToken) 24 | XCTAssertEqual("test-email", result.email!) 25 | XCTAssertEqual("test-first-name", result.firstName!) 26 | XCTAssertEqual("test-last-name", result.lastName!) 27 | XCTAssertEqual("test-name", result.name!) 28 | } 29 | 30 | func testParse_withMissingOptionalFields() { 31 | dictionary = [ 32 | "id": "test-id" 33 | ] 34 | 35 | let result = FacebookUserLoader.parseMeData(dictionary, accessToken: "test-access-token")! 36 | XCTAssertEqual("test-id", result.id) 37 | XCTAssertEqual("test-access-token", result.accessToken) 38 | XCTAssert(result.email == nil) 39 | XCTAssert(result.firstName == nil) 40 | XCTAssert(result.lastName == nil) 41 | XCTAssert(result.name == nil) 42 | } 43 | 44 | func testParseWhenIdIsNotFound() { 45 | dictionary = [ 46 | "email": "test-email", 47 | "first_name": "test-first-name", 48 | "last_name": "test-last-name", 49 | "name": "test-name" 50 | ] 51 | 52 | let result = FacebookUserLoader.parseMeData(dictionary, accessToken: "test-access-token") 53 | XCTAssert(result == nil) 54 | } 55 | } -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKWebDialogView.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | @protocol FBSDKWebDialogViewDelegate; 22 | 23 | @interface FBSDKWebDialogView : UIView 24 | 25 | @property (nonatomic, assign) id delegate; 26 | 27 | - (void)loadURL:(NSURL *)URL; 28 | - (void)stopLoading; 29 | 30 | @end 31 | 32 | @protocol FBSDKWebDialogViewDelegate 33 | 34 | - (void)webDialogView:(FBSDKWebDialogView *)webDialogView didCompleteWithResults:(NSDictionary *)results; 35 | - (void)webDialogView:(FBSDKWebDialogView *)webDialogView didFailWithError:(NSError *)error; 36 | - (void)webDialogViewDidCancel:(FBSDKWebDialogView *)webDialogView; 37 | - (void)webDialogViewDidFinishLoad:(FBSDKWebDialogView *)webDialogView; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /LoadFacebookProfile/ViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import LoadFacebookProfileKit 3 | 4 | class ViewController: UIViewController { 5 | @IBOutlet weak var loginLogoutButton: UIButton! 6 | @IBOutlet weak var userInfoLabel: UILabel! 7 | 8 | private let loader = FacebookUserLoader() 9 | 10 | required init?(coder aDecoder: NSCoder) { 11 | super.init(coder: aDecoder) 12 | } 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | stubUserForUITests() 18 | 19 | userInfoLabel.text = "" 20 | } 21 | 22 | @IBAction func onLoginWithFacebookButtonTapped(sender: AnyObject) { 23 | userInfoLabel.text = "" 24 | 25 | loader.load(askEmail: true, onError: { [weak self] in 26 | self?.userInfoLabel.text = "Error occured" 27 | }, 28 | onSuccess: { [weak self] user in 29 | self?.onUserLoaded(user) 30 | }) 31 | } 32 | 33 | private func onUserLoaded(user: TegFacebookUser) { 34 | var fields = ["User id: \(user.id)"] 35 | 36 | if let name = user.name { 37 | fields.append("Name: \(name)") 38 | } 39 | 40 | if let email = user.email { 41 | fields.append("Email: \(email)") 42 | } 43 | 44 | fields.append("Access token: \(user.accessToken)") 45 | 46 | let outputText = "\n\n".join(fields) 47 | 48 | userInfoLabel.text = outputText 49 | print(outputText) 50 | } 51 | 52 | private func stubUserForUITests() { 53 | if ViewController.isUITesting() { 54 | FacebookUserLoader.simulateSuccessUser = TegFacebookUser(id: "fake-user-id", 55 | accessToken: "fake-access-token", 56 | email: nil, 57 | firstName: nil, 58 | lastName: nil, 59 | name: nil) 60 | } 61 | } 62 | 63 | private class func isUITesting() -> Bool { 64 | let environment = NSProcessInfo.processInfo().environment 65 | let runningUITests = environment["RUNNING_UI_TESTS"] 66 | return runningUITests == "YES" 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKCoreKit.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | 37 | #define FBSDK_VERSION_STRING @"4.1.0" 38 | #define FBSDK_TARGET_PLATFORM_VERSION @"v2.3" 39 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKGraphRequestBody.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | #import 21 | 22 | @class FBSDKGraphRequestDataAttachment; 23 | @class FBSDKLogger; 24 | 25 | @interface FBSDKGraphRequestBody : NSObject 26 | 27 | @property (nonatomic, retain, readonly) NSData *data; 28 | 29 | - (void)appendWithKey:(NSString *)key 30 | formValue:(NSString *)value 31 | logger:(FBSDKLogger *)logger; 32 | 33 | - (void)appendWithKey:(NSString *)key 34 | imageValue:(UIImage *)image 35 | logger:(FBSDKLogger *)logger; 36 | 37 | - (void)appendWithKey:(NSString *)key 38 | dataValue:(NSData *)data 39 | logger:(FBSDKLogger *)logger; 40 | 41 | - (void)appendWithKey:(NSString *)key 42 | dataAttachmentValue:(FBSDKGraphRequestDataAttachment *)dataAttachment 43 | logger:(FBSDKLogger *)logger; 44 | 45 | + (NSString *)mimeContentType; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /LoadFacebookProfile/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | FB profile 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleURLTypes 24 | 25 | 26 | CFBundleURLSchemes 27 | 28 | fb1602213896709804 29 | 30 | 31 | 32 | CFBundleVersion 33 | 1 34 | FacebookAppID 35 | 1602213896709804 36 | FacebookDisplayName 37 | LoadUserProfile 38 | LSRequiresIPhoneOS 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIMainStoryboardFile 43 | Main 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKGraphRequestMetadata.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | // Internal only class to facilitate FBRequest processing, specifically 24 | // associating FBRequest and FBRequestHandler instances and necessary 25 | // data for retry processing. 26 | @interface FBSDKGraphRequestMetadata : NSObject 27 | 28 | @property (nonatomic, retain) FBSDKGraphRequest *request; 29 | @property (nonatomic, copy) FBSDKGraphRequestHandler completionHandler; 30 | @property (nonatomic, copy) NSDictionary *batchParameters; 31 | 32 | - (instancetype)initWithRequest:(FBSDKGraphRequest *)request 33 | completionHandler:(FBSDKGraphRequestHandler)handler 34 | batchParameters:(NSDictionary *)batchParameters 35 | NS_DESIGNATED_INITIALIZER; 36 | 37 | - (void)invokeCompletionHandlerForConnection:(FBSDKGraphRequestConnection *)connection 38 | withResults:(id)results 39 | error:(NSError *)error; 40 | @end 41 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKMacros.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #ifdef __cplusplus 22 | #define FBSDK_EXTERN extern "C" __attribute__((visibility ("default"))) 23 | #else 24 | #define FBSDK_EXTERN extern __attribute__((visibility ("default"))) 25 | #endif 26 | 27 | #define FBSDK_STATIC_INLINE static inline 28 | 29 | #define FBSDK_NO_DESIGNATED_INITIALIZER() \ 30 | @throw [NSException exceptionWithName:NSInvalidArgumentException \ 31 | reason:[NSString stringWithFormat:@"unrecognized selector sent to instance %p", self] \ 32 | userInfo:nil] 33 | 34 | #define FBSDK_NOT_DESIGNATED_INITIALIZER(DESIGNATED_INITIALIZER) \ 35 | @throw [NSException exceptionWithName:NSInvalidArgumentException \ 36 | reason:[NSString stringWithFormat:@"Please use the designated initializer [%p %@]", \ 37 | self, \ 38 | NSStringFromSelector(@selector(DESIGNATED_INITIALIZER))] \ 39 | userInfo:nil] 40 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKGraphRequestDataAttachment.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | /*! 22 | @abstract A container class for data attachments so that additional metadata can be provided about the attachment. 23 | */ 24 | @interface FBSDKGraphRequestDataAttachment : NSObject 25 | 26 | /*! 27 | @abstract Initializes the receiver with the attachment data and metadata. 28 | @param data The attachment data (retained, not copied) 29 | @param filename The filename for the attachment 30 | @param contentType The content type for the attachment 31 | */ 32 | - (instancetype)initWithData:(NSData *)data 33 | filename:(NSString *)filename 34 | contentType:(NSString *)contentType 35 | NS_DESIGNATED_INITIALIZER; 36 | 37 | /*! 38 | @abstract The content type for the attachment. 39 | */ 40 | @property (nonatomic, copy, readonly) NSString *contentType; 41 | 42 | /*! 43 | @abstract The attachment data. 44 | */ 45 | @property (nonatomic, strong, readonly) NSData *data; 46 | 47 | /*! 48 | @abstract The filename for the attachment. 49 | */ 50 | @property (nonatomic, copy, readonly) NSString *filename; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKURLConnection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | @class FBSDKURLConnection; 22 | 23 | typedef void (^FBSDKURLConnectionHandler)(FBSDKURLConnection *connection, 24 | NSError *error, 25 | NSURLResponse *response, 26 | NSData *responseData); 27 | 28 | @protocol FBSDKURLConnectionDelegate 29 | 30 | @optional 31 | 32 | - (void)facebookURLConnection:(FBSDKURLConnection *)connection 33 | didSendBodyData:(NSInteger)bytesWritten 34 | totalBytesWritten:(NSInteger)totalBytesWritten 35 | totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite; 36 | 37 | @end 38 | 39 | @interface FBSDKURLConnection : NSObject 40 | 41 | - (FBSDKURLConnection *)initWithRequest:(NSURLRequest *)request 42 | completionHandler:(FBSDKURLConnectionHandler)handler 43 | NS_DESIGNATED_INITIALIZER; 44 | 45 | @property (nonatomic, assign) id delegate; 46 | 47 | - (void)cancel; 48 | - (void)start; 49 | - (void)setDelegateQueue:(NSOperationQueue *)queue; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocol.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | #import "FBSDKBridgeAPIProtocolType.h" 24 | 25 | @class FBSDKBridgeAPIRequest; 26 | 27 | FBSDK_EXTERN NSString *const FBSDKBridgeAPIAppIDKey; 28 | FBSDK_EXTERN NSString *const FBSDKBridgeAPISchemeSuffixKey; 29 | FBSDK_EXTERN NSString *const FBSDKBridgeAPIVersionKey; 30 | 31 | @protocol FBSDKBridgeAPIProtocol 32 | 33 | @property (nonatomic, assign, readonly, getter=isEnabled) BOOL enabled; 34 | 35 | - (NSURL *)requestURLWithActionID:(NSString *)actionID 36 | scheme:(NSString *)scheme 37 | methodName:(NSString *)methodName 38 | methodVersion:(NSString *)methodVersion 39 | parameters:(NSDictionary *)parameters 40 | error:(NSError *__autoreleasing *)errorRef; 41 | - (NSDictionary *)responseParametersForActionID:(NSString *)actionID 42 | queryParameters:(NSDictionary *)queryParameters 43 | cancelled:(BOOL *)cancelledRef 44 | error:(NSError *__autoreleasing *)errorRef; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKUtility.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | /*! 22 | @abstract Class to contain common utility methods. 23 | */ 24 | @interface FBSDKUtility : NSObject 25 | 26 | /*! 27 | @abstract Parses a query string into a dictionary. 28 | @param queryString The query string value. 29 | @return A dictionary with the key/value pairs. 30 | */ 31 | + (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString; 32 | 33 | /*! 34 | @abstract Constructs a query string from a dictionary. 35 | @param dictionary The dictionary with key/value pairs for the query string. 36 | @param errorRef If an error occurs, upon return contains an NSError object that describes the problem. 37 | @result Query string representation of the parameters. 38 | */ 39 | + (NSString *)queryStringWithDictionary:(NSDictionary *)dictionary error:(NSError *__autoreleasing *)errorRef; 40 | 41 | /*! 42 | @abstract Decodes a value from an URL. 43 | @param value The value to decode. 44 | @result The decoded value. 45 | */ 46 | + (NSString *)URLDecode:(NSString *)value; 47 | 48 | /*! 49 | @abstract Encodes a value for an URL. 50 | @param value The value to encode. 51 | @result The encoded value. 52 | */ 53 | + (NSString *)URLEncode:(NSString *)value; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKProfilePictureView.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | /*! 22 | @typedef FBSDKProfilePictureMode enum 23 | @abstract Defines the aspect ratio mode for the source image of the profile picture. 24 | */ 25 | typedef NS_ENUM(NSUInteger, FBSDKProfilePictureMode) 26 | { 27 | /*! 28 | @abstract A square cropped version of the image will be included in the view. 29 | */ 30 | FBSDKProfilePictureModeSquare, 31 | /*! 32 | @abstract The original picture's aspect ratio will be used for the source image in the view. 33 | */ 34 | FBSDKProfilePictureModeNormal, 35 | }; 36 | 37 | /*! 38 | @abstract A view to display a profile picture. 39 | */ 40 | @interface FBSDKProfilePictureView : UIView 41 | 42 | /*! 43 | @abstract The mode for the receiver to determine the aspect ratio of the source image. 44 | */ 45 | @property (nonatomic, assign) FBSDKProfilePictureMode pictureMode; 46 | 47 | /*! 48 | @abstract The profile ID to show the picture for. 49 | */ 50 | @property (nonatomic, copy) NSString *profileID; 51 | 52 | /*! 53 | @abstract Explicitly marks the receiver as needing to update the image. 54 | @discussion This method is called whenever any properties that affect the source image are modified, but this can also 55 | be used to trigger a manual update of the image if it needs to be re-downloaded. 56 | */ 57 | - (void)setNeedsImageUpdate; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/Headers/FBSDKLoginManagerLoginResult.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | @class FBSDKAccessToken; 22 | 23 | /*! 24 | @abstract Describes the result of a login attempt. 25 | */ 26 | @interface FBSDKLoginManagerLoginResult : NSObject 27 | 28 | /*! 29 | @abstract the access token. 30 | */ 31 | @property (copy, nonatomic) FBSDKAccessToken *token; 32 | 33 | /*! 34 | @abstract whether the login was cancelled by the user. 35 | */ 36 | @property (readonly, nonatomic) BOOL isCancelled; 37 | 38 | /*! 39 | @abstract the set of permissions granted by the user in the associated request. 40 | @discussion inspect the token's permissions set for a complete list. 41 | */ 42 | @property (copy, nonatomic) NSSet *grantedPermissions; 43 | 44 | /*! 45 | @abstract the set of permissions declined by the user in the associated request. 46 | @discussion inspect the token's permissions set for a complete list. 47 | */ 48 | @property (copy, nonatomic) NSSet *declinedPermissions; 49 | 50 | /*! 51 | @abstract Initializes a new instance. 52 | @param token the access token 53 | @param isCancelled whether the login was cancelled by the user 54 | @param grantedPermissions the set of granted permissions 55 | @param declinedPermissions the set of declined permissions 56 | */ 57 | - (instancetype)initWithToken:(FBSDKAccessToken *)token 58 | isCancelled:(BOOL)isCancelled 59 | grantedPermissions:(NSSet *)grantedPermissions 60 | declinedPermissions:(NSSet *)declinedPermissions 61 | NS_DESIGNATED_INITIALIZER; 62 | @end 63 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKAppLinkUtility.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | /*! 22 | @abstract Describes the callback for fetchDeferredAppLink. 23 | @param url the url representing the deferred App Link 24 | @param error the error during the request, if any 25 | 26 | @discussion The url may also have a fb_click_time_utc query parameter that 27 | represents when the click occurred that caused the deferred App Link to be created. 28 | */ 29 | typedef void (^FBSDKDeferredAppLinkHandler)(NSURL *url, NSError *error); 30 | 31 | /*! 32 | @abstract Class containing App Links related utility methods. 33 | */ 34 | @interface FBSDKAppLinkUtility : NSObject 35 | 36 | /*! 37 | @abstract 38 | Call this method from the main thread to fetch deferred applink data if you use Mobile App 39 | Engagement Ads (https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads-engagement). 40 | This may require a network round trip. If successful, the handler is invoked with the link 41 | data (this will only return a valid URL once, and future calls will result in a nil URL 42 | value in the callback). 43 | 44 | @param handler the handler to be invoked if there is deferred App Link data 45 | 46 | @discussion The handler may contain an NSError instance to capture any errors. In the 47 | common case where there simply was no app link data, the NSError instance will be nil. 48 | 49 | This method should only be called from a location that occurs after any launching URL has 50 | been processed (e.g., you should call this method from your application delegate's 51 | applicationDidBecomeActive:). 52 | */ 53 | + (void)fetchDeferredAppLink:(FBSDKDeferredAppLinkHandler)handler; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/Headers/FBSDKLoginConstants.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | /*! 24 | @abstract The error domain for all errors from FBSDKLoginKit 25 | @discussion Error codes from the SDK in the range 300-399 are reserved for this domain. 26 | */ 27 | FBSDK_EXTERN NSString *const FBSDKLoginErrorDomain; 28 | 29 | /*! 30 | @typedef NS_ENUM(NSInteger, FBSDKLoginErrorCode) 31 | @abstract Error codes for FBSDKLoginErrorDomain. 32 | */ 33 | typedef NS_ENUM(NSInteger, FBSDKLoginErrorCode) 34 | { 35 | /*! 36 | @abstract Reserved. 37 | */ 38 | FBSDKLoginReservedErrorCode = 300, 39 | /*! 40 | @abstract The error code for unknown errors. 41 | */ 42 | FBSDKLoginUnknownErrorCode, 43 | 44 | /*! 45 | @abstract The user's password has changed and must log in again 46 | */ 47 | FBSDKLoginPasswordChangedErrorCode, 48 | /*! 49 | @abstract The user must log in to their account on www.facebook.com to restore access 50 | */ 51 | FBSDKLoginUserCheckpointedErrorCode, 52 | /*! 53 | @abstract Indicates a failure to request new permissions because the user has changed. 54 | */ 55 | FBSDKLoginUserMismatchErrorCode, 56 | /*! 57 | @abstract The user must confirm their account with Facebook before logging in 58 | */ 59 | FBSDKLoginUnconfirmedUserErrorCode, 60 | 61 | /*! 62 | @abstract The Accounts framework failed without returning an error, indicating the 63 | app's slider in the iOS Facebook Settings (device Settings -> Facebook -> App Name) has 64 | been disabled. 65 | */ 66 | FBSDKLoginSystemAccountAppDisabledErrorCode, 67 | /*! 68 | @abstract An error occurred related to Facebook system Account store 69 | */ 70 | FBSDKLoginSystemAccountUnavailableErrorCode, 71 | }; 72 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKError.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | @interface FBSDKError : NSObject 22 | 23 | + (NSString *)errorDomain; 24 | 25 | + (BOOL)errorIsNetworkError:(NSError *)error; 26 | 27 | + (NSError *)errorWithCode:(NSInteger)code message:(NSString *)message; 28 | + (NSError *)errorWithCode:(NSInteger)code message:(NSString *)message underlyingError:(NSError *)underlyingError; 29 | + (NSError *)errorWithCode:(NSInteger)code 30 | userInfo:(NSDictionary *)userInfo 31 | message:(NSString *)message 32 | underlyingError:(NSError *)underlyingError; 33 | 34 | + (NSError *)invalidArgumentErrorWithName:(NSString *)name value:(id)value message:(NSString *)message; 35 | + (NSError *)invalidArgumentErrorWithName:(NSString *)name 36 | value:(id)value 37 | message:(NSString *)message 38 | underlyingError:(NSError *)underlyingError; 39 | + (NSError *)invalidCollectionErrorWithName:(NSString *)name 40 | collection:(id)collection 41 | item:(id)item 42 | message:(NSString *)message; 43 | + (NSError *)invalidCollectionErrorWithName:(NSString *)name 44 | collection:(id)collection 45 | item:(id)item 46 | message:(NSString *)message 47 | underlyingError:(NSError *)underlyingError; 48 | 49 | + (NSError *)requiredArgumentErrorWithName:(NSString *)name message:(NSString *)message; 50 | + (NSError *)requiredArgumentErrorWithName:(NSString *)name 51 | message:(NSString *)message 52 | underlyingError:(NSError *)underlyingError; 53 | 54 | + (NSError *)unknownErrorWithMessage:(NSString *)message; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocolNativeV1.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | #import "FBSDKBridgeAPIProtocol.h" 24 | 25 | typedef struct 26 | { 27 | __unsafe_unretained NSString *bridgeArgs; 28 | __unsafe_unretained NSString *methodArgs; 29 | __unsafe_unretained NSString *methodVersion; 30 | } FBSDKBridgeAPIProtocolNativeV1OutputKeysStruct; 31 | FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1OutputKeysStruct FBSDKBridgeAPIProtocolNativeV1OutputKeys; 32 | 33 | typedef struct 34 | { 35 | __unsafe_unretained NSString *actionID; 36 | __unsafe_unretained NSString *appIcon; 37 | __unsafe_unretained NSString *appName; 38 | __unsafe_unretained NSString *sdkVersion; 39 | } FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeysStruct; 40 | FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeysStruct FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeys; 41 | 42 | typedef struct 43 | { 44 | __unsafe_unretained NSString *bridgeArgs; 45 | __unsafe_unretained NSString *methodResults; 46 | } FBSDKBridgeAPIProtocolNativeV1InputKeysStruct; 47 | FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1InputKeysStruct FBSDKBridgeAPIProtocolNativeV1InputKeys; 48 | 49 | typedef struct 50 | { 51 | __unsafe_unretained NSString *actionID; 52 | __unsafe_unretained NSString *error; 53 | } FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeysStruct; 54 | FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeysStruct FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeys; 55 | 56 | @interface FBSDKBridgeAPIProtocolNativeV1 : NSObject 57 | 58 | - (instancetype)initWithAppScheme:(NSString *)appScheme; 59 | - (instancetype)initWithAppScheme:(NSString *)appScheme 60 | pasteboard:(UIPasteboard *)pasteboard 61 | dataLengthThreshold:(NSUInteger)dataLengthThreshold 62 | includeAppIcon:(BOOL)includeAppIcon 63 | NS_DESIGNATED_INITIALIZER; 64 | 65 | @property (nonatomic, copy, readonly) NSString *appScheme; 66 | @property (nonatomic, assign, readonly) NSUInteger dataLengthThreshold; 67 | @property (nonatomic, assign, readonly) BOOL includeAppIcon; 68 | @property (nonatomic, strong, readonly) UIPasteboard *pasteboard; 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | @class BFTask; 22 | 23 | // Check if Bolts.framework is available for import 24 | #if __has_include() 25 | // Import it if it's available 26 | # import 27 | #else 28 | // Otherwise - redeclare BFAppLinkResolving protocol to resolve the problem of missing symbols 29 | // Please note: Bolts.framework is still required for AppLink resolving to work, 30 | // but this allows FBSDKCoreKit to weakly link Bolts.framework as well as this enables clang modulemaps to work. 31 | 32 | /*! 33 | Implement this protocol to provide an alternate strategy for resolving 34 | App Links that may include pre-fetching, caching, or querying for App Link 35 | data from an index provided by a service provider. 36 | */ 37 | @protocol BFAppLinkResolving 38 | 39 | /*! 40 | Asynchronously resolves App Link data for a given URL. 41 | 42 | @param url The URL to resolve into an App Link. 43 | @returns A BFTask that will return a BFAppLink for the given URL. 44 | */ 45 | - (BFTask *)appLinkFromURLInBackground:(NSURL *)url; 46 | 47 | @end 48 | 49 | #endif 50 | 51 | /*! 52 | @class FBSDKAppLinkResolver 53 | 54 | @abstract 55 | Provides an implementation of the BFAppLinkResolving protocol that uses the Facebook App Link 56 | Index API to resolve App Links given a URL. It also provides an additional helper method that can resolve 57 | multiple App Links in a single call. 58 | 59 | @discussion 60 | Usage of this type requires a client token. See `[FBSDKSettings setClientToken:]` and linking 61 | Bolts.framework 62 | */ 63 | @interface FBSDKAppLinkResolver : NSObject 64 | 65 | /*! 66 | @abstract Asynchronously resolves App Link data for multiple URLs. 67 | 68 | @param urls An array of NSURLs to resolve into App Links. 69 | @returns A BFTask that will return dictionary mapping input NSURLs to their 70 | corresponding BFAppLink. 71 | 72 | @discussion 73 | You should set the client token before making this call. See `[FBSDKSettings setClientToken:]` 74 | */ 75 | - (BFTask *)appLinksFromURLsInBackground:(NSArray *)urls; 76 | 77 | /*! 78 | @abstract Allocates and initializes a new instance of FBSDKAppLinkResolver. 79 | */ 80 | + (instancetype)resolver; 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Load Facebook user profile with Facebook SDK on iOS using Swift 2 | 3 | This is a demo app and a helper function for loading Facebook user profile: 4 | 5 | * Facebook user ID 6 | * Access token 7 | * Email 8 | * First name 9 | * Last name 10 | * Name 11 | 12 | Facebook user ID and access token can be used to authenticate Facebook user in your app. 13 | The helper function can be useful for those who just need to load a Facebook user profile from code without using other SDK features. 14 | 15 | Load Facebook user profile on iOS swift with Facebook SDK 16 | 17 | ## To run this demo app 18 | 19 | 1. Open `Info.plist` file. 20 | 2. Update "Bundle identifier", "URL types", "FacebookAppID" and "FacebookDisplayName" with your facebook app information. See [Facebook iOS SDK](https://developers.facebook.com/docs/ios/getting-started) for more details. 21 | 22 | change plist 23 | 24 | ## Setup in your app 25 | 26 | 1. Add Facebook SDK to your app. Follow instructions on Facebook developer pages. See [Facebook iOS SDK](https://developers.facebook.com/docs/ios/getting-started) 27 | 2. Add [FacebookUserLoader.swift](https://github.com/marketplacer/load-facebook-profile-ios-swift/blob/master/LoadFacebookProfileKit/FacebookUserLoader.swift) and [TegFacebookUser.swift](https://github.com/marketplacer/load-facebook-profile-ios-swift/blob/master/LoadFacebookProfileKit/TegFacebookUser.swift) to your project. 28 | 29 | #### Setup with Carthage 30 | 31 | Alternatively, if you are using Carthage, you can add the following to your Cartfile and run `carthage update` 32 | 33 | ``` 34 | github "marketplacer/load-facebook-profile-ios-swift" ~> 3.0 35 | ``` 36 | 37 | ## Usage 38 | 39 | ```Swift 40 | import LoadFacebookProfileKit 41 | 42 | let loader = FacebookUserLoader() // Keep strong reference 43 | 44 | ... 45 | 46 | loader.load(askEmail: true, 47 | onError: { }, 48 | onSuccess: { user in 49 | // User has logged in with Facebook 50 | } 51 | ) 52 | ``` 53 | 54 | ## Profile fields can be empty 55 | 56 | Please note that user may deny sharing all or some of the profile information. There is no guarantee, for example, that your app will get email address. 57 | 58 | ## Verifying user ID on server side 59 | 60 | In order to authenticate a user one needs to verify its `facebook user id` on server side. Send the following request from your server and compare the returned user id with the one loaded by `TegFacebookUserLoader.load` function. 61 | 62 | ``` 63 | https://graph.facebook.com/me?fields=id&access_token=YOUR_ACCCESS_TOKEN 64 | ``` 65 | 66 | ## Unit tests 67 | 68 | Sometimes it is useful to bypass the Facebook login in Facebook. Here is how to setup fake Facebook responses that will be used when calling `load` method of `FacebookUserLoader` object. 69 | 70 | ```Swift 71 | // Call `onSuccess` with the supplied user without touching Facebook SDK. 72 | FacebookUserLoader.simulateSuccessUser = TegFacebookUser(id: "fake user id", 73 | accessToken: "test access token", 74 | email: "test@email.com", 75 | firstName: "test first name", 76 | lastName: "test last name", 77 | name: "test name" 78 | ) 79 | ``` 80 | 81 | ```Swift 82 | // Delay used to simulate Facebook response. If 0 response is returned synchronously. 83 | FacebookUserLoader.simulateLoadAfterDelay = 0.1 84 | ``` 85 | 86 | ```Swift 87 | // Call `onError` function without touching Facebook SDK. 88 | FacebookUserLoader.simulateError = true 89 | ``` 90 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKApplicationDelegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | /*! 22 | @class FBSDKApplicationDelegate 23 | 24 | @abstract 25 | The FBSDKApplicationDelegate is designed to post process the results from Facebook Login 26 | or Facebook Dialogs (or any action that requires switching over to the native Facebook 27 | app or Safari). 28 | 29 | @discussion 30 | The methods in this class are designed to mirror those in UIApplicationDelegate, and you 31 | should call them in the respective methods in your AppDelegate implementation. 32 | */ 33 | @interface FBSDKApplicationDelegate : NSObject 34 | 35 | /*! 36 | @abstract Gets the singleton instance. 37 | */ 38 | + (instancetype)sharedInstance; 39 | 40 | /*! 41 | @abstract 42 | Call this method from the [UIApplicationDelegate application:openURL:sourceApplication:annotation:] method 43 | of the AppDelegate for your app. It should be invoked for the proper processing of responses during interaction 44 | with the native Facebook app or Safari as part of SSO authorization flow or Facebook dialogs. 45 | 46 | @param application The application as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. 47 | 48 | @param url The URL as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. 49 | 50 | @param sourceApplication The sourceApplication as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. 51 | 52 | @param annotation The annotation as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. 53 | 54 | @return YES if the url was intended for the Facebook SDK, NO if not. 55 | */ 56 | - (BOOL)application:(UIApplication *)application 57 | openURL:(NSURL *)url 58 | sourceApplication:(NSString *)sourceApplication 59 | annotation:(id)annotation; 60 | 61 | /*! 62 | @abstract 63 | Call this method from the [UIApplicationDelegate application:didFinishLaunchingWithOptions:] method 64 | of the AppDelegate for your app. It should be invoked for the proper use of the Facebook SDK. 65 | 66 | @param application The application as passed to [UIApplicationDelegate application:didFinishLaunchingWithOptions:]. 67 | 68 | @param launchOptions The launchOptions as passed to [UIApplicationDelegate application:didFinishLaunchingWithOptions:]. 69 | 70 | @return YES if the url was intended for the Facebook SDK, NO if not. 71 | */ 72 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/Headers/FBSDKLoginTooltipView.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | @protocol FBSDKLoginTooltipViewDelegate; 24 | 25 | /*! 26 | @class FBSDKLoginTooltipView 27 | 28 | @abstract Represents a tooltip to be displayed next to a Facebook login button 29 | to highlight features for new users. 30 | 31 | @discussion The `FBSDKLoginButton` may display this view automatically. If you do 32 | not use the `FBSDKLoginButton`, you can manually call one of the `present*` methods 33 | as appropriate and customize behavior via `FBSDKLoginTooltipViewDelegate` delegate. 34 | 35 | By default, the `FBSDKLoginTooltipView` is not added to the superview until it is 36 | determined the app has migrated to the new login experience. You can override this 37 | (e.g., to test the UI layout) by implementing the delegate or setting `forceDisplay` to YES. 38 | 39 | */ 40 | @interface FBSDKLoginTooltipView : FBSDKTooltipView 41 | 42 | /*! @abstract the delegate */ 43 | @property (nonatomic, assign) id delegate; 44 | 45 | /*! @abstract if set to YES, the view will always be displayed and the delegate's 46 | `loginTooltipView:shouldAppear:` will NOT be called. */ 47 | @property (nonatomic, assign) BOOL forceDisplay; 48 | 49 | @end 50 | 51 | /*! 52 | @protocol 53 | 54 | @abstract 55 | The `FBSDKLoginTooltipViewDelegate` protocol defines the methods used to receive event 56 | notifications from `FBSDKLoginTooltipView` objects. 57 | */ 58 | @protocol FBSDKLoginTooltipViewDelegate 59 | 60 | @optional 61 | 62 | /*! 63 | @abstract 64 | Asks the delegate if the tooltip view should appear 65 | 66 | @param view The tooltip view. 67 | @param appIsEligible The value fetched from the server identifying if the app 68 | is eligible for the new login experience. 69 | 70 | @discussion Use this method to customize display behavior. 71 | */ 72 | - (BOOL)loginTooltipView:(FBSDKLoginTooltipView *)view shouldAppear:(BOOL)appIsEligible; 73 | 74 | /*! 75 | @abstract 76 | Tells the delegate the tooltip view will appear, specifically after it's been 77 | added to the super view but before the fade in animation. 78 | 79 | @param view The tooltip view. 80 | */ 81 | - (void)loginTooltipViewWillAppear:(FBSDKLoginTooltipView *)view; 82 | 83 | /*! 84 | @abstract 85 | Tells the delegate the tooltip view will not appear (i.e., was not 86 | added to the super view). 87 | 88 | @param view The tooltip view. 89 | */ 90 | - (void)loginTooltipViewWillNotAppear:(FBSDKLoginTooltipView *)view; 91 | 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /LoadFacebookProfileKitTests/FakeLoginWithFacebookTests.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import XCTest 3 | @testable import LoadFacebookProfileKit 4 | 5 | class FakeLoginWithFacebookTests: XCTestCase { 6 | var dictionary: [String: AnyObject]! 7 | 8 | override func setUp() { 9 | super.setUp() 10 | } 11 | 12 | override func tearDown() { 13 | super.tearDown() 14 | FacebookUserLoader.simulateLoadAfterDelay = 0.1 15 | FacebookUserLoader.simulateSuccessUser = nil 16 | FacebookUserLoader.simulateError = false 17 | } 18 | 19 | func testLoadUser() { 20 | FacebookUserLoader.simulateSuccessUser = TegFacebookUser(id: "fake user id", 21 | accessToken: "test access tokeb", 22 | email: "test@email.com", 23 | firstName: "test first name", 24 | lastName: "test last name", 25 | name: "test name" 26 | ) 27 | 28 | let loader = FacebookUserLoader() 29 | 30 | var errorReturned = false 31 | var userReturned: TegFacebookUser? 32 | 33 | let expectation = expectationWithDescription("load facebook profile") 34 | 35 | loader.load(askEmail: true, onError: { 36 | errorReturned = true 37 | }, 38 | onSuccess: { user in 39 | expectation.fulfill() 40 | userReturned = user 41 | } 42 | ) 43 | 44 | waitForExpectationsWithTimeout(1) { error in } 45 | 46 | XCTAssertFalse(errorReturned) 47 | XCTAssertEqual("test@email.com", userReturned!.email!) 48 | } 49 | 50 | func testLoadUser_synchronously() { 51 | FacebookUserLoader.simulateSuccessUser = TegFacebookUser(id: "fake user id", 52 | accessToken: "test access tokeb", 53 | email: "test@email.com", 54 | firstName: "test first name", 55 | lastName: "test last name", 56 | name: "test name" 57 | ) 58 | 59 | FacebookUserLoader.simulateLoadAfterDelay = 0 60 | 61 | let loader = FacebookUserLoader() 62 | 63 | var errorReturned = false 64 | var userReturned: TegFacebookUser? 65 | 66 | 67 | 68 | loader.load(askEmail: true, onError: { 69 | errorReturned = true 70 | }, 71 | onSuccess: { user in 72 | userReturned = user 73 | } 74 | ) 75 | 76 | XCTAssertFalse(errorReturned) 77 | XCTAssertEqual("test@email.com", userReturned!.email!) 78 | } 79 | 80 | func testLoadUser_returnError() { 81 | FacebookUserLoader.simulateError = true 82 | 83 | let loader = FacebookUserLoader() 84 | 85 | var errorReturned = false 86 | var userReturned: TegFacebookUser? 87 | 88 | let expectation = expectationWithDescription("load facebook profile") 89 | 90 | loader.load(askEmail: true, onError: { 91 | errorReturned = true 92 | expectation.fulfill() 93 | }, 94 | onSuccess: { user in 95 | userReturned = user 96 | } 97 | ) 98 | 99 | waitForExpectationsWithTimeout(1) { error in } 100 | 101 | XCTAssert(errorReturned) 102 | XCTAssert(userReturned == nil) 103 | } 104 | 105 | func testLoadUser_returnErrorSynchronously() { 106 | FacebookUserLoader.simulateError = true 107 | FacebookUserLoader.simulateLoadAfterDelay = 0 108 | 109 | let loader = FacebookUserLoader() 110 | 111 | var errorReturned = false 112 | var userReturned: TegFacebookUser? 113 | 114 | 115 | loader.load(askEmail: true, onError: { 116 | errorReturned = true 117 | }, 118 | onSuccess: { user in 119 | userReturned = user 120 | } 121 | ) 122 | 123 | XCTAssert(errorReturned) 124 | XCTAssert(userReturned == nil) 125 | } 126 | 127 | } -------------------------------------------------------------------------------- /LoadFacebookProfile/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LoadFacebookProfile.xcodeproj/xcshareddata/xcschemes/LoadFacebookProfile.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/Headers/FBSDKLoginButton.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | #import 24 | 25 | #import "FBSDKTooltipView.h" 26 | 27 | @protocol FBSDKLoginButtonDelegate; 28 | 29 | /*! 30 | @typedef NS_ENUM(NSUInteger, FBSDKLoginButtonTooltipBehavior) 31 | @abstract Indicates the desired login tooltip behavior. 32 | */ 33 | typedef NS_ENUM(NSUInteger, FBSDKLoginButtonTooltipBehavior) 34 | { 35 | /*! The default behavior. The tooltip will only be displayed if 36 | the app is eligible (determined by possible server round trip) */ 37 | FBSDKLoginButtonTooltipBehaviorAutomatic = 0, 38 | /*! Force display of the tooltip (typically for UI testing) */ 39 | FBSDKLoginButtonTooltipBehaviorForceDisplay = 1, 40 | /*! Force disable. In this case you can still exert more refined 41 | control by manually constructing a `FBSDKLoginTooltipView` instance. */ 42 | FBSDKLoginButtonTooltipBehaviorDisable = 2 43 | }; 44 | 45 | /*! 46 | @abstract A button to simplify login. 47 | @discussion `FBSDKLoginButton` works with `[FBSDKAccessToken currentAccessToken]` to 48 | determine what to display. The delegate is only notified when a login flow is initiated 49 | by a tapping the button and your app delegate is connected to `FBSDKApplicationDelegate` 50 | (in the same way when using `FBSDKLoginManager`). 51 | 52 | `FBSDKLoginButton` has a fixed height, but you may change the width. `initWithFrame:CGRectZero` 53 | will size the button to its minimum frame. 54 | */ 55 | @interface FBSDKLoginButton : FBSDKButton 56 | 57 | /*! 58 | @abstract The default audience to use, if publish permissions are requested at login time. 59 | */ 60 | @property (assign, nonatomic) FBSDKDefaultAudience defaultAudience; 61 | /*! 62 | @abstract Gets or sets the delegate. 63 | */ 64 | @property (weak, nonatomic) IBOutlet id delegate; 65 | /*! 66 | @abstract Gets or sets the login behavior to use 67 | */ 68 | @property (assign, nonatomic) FBSDKLoginBehavior loginBehavior; 69 | /*! 70 | @abstract The publish permissions to request. 71 | 72 | @discussion Use `defaultAudience` to specify the default audience to publish to. 73 | Note this is converted to NSSet and is only 74 | an NSArray for the convenience of literal syntax. 75 | */ 76 | @property (copy, nonatomic) NSArray *publishPermissions; 77 | /*! 78 | @abstract The read permissions to request. 79 | 80 | @discussion Note, that if read permissions are specified, then publish permissions should not be specified. This is converted to NSSet and is only 81 | an NSArray for the convenience of literal syntax. 82 | */ 83 | @property (copy, nonatomic) NSArray *readPermissions; 84 | /*! 85 | @abstract Gets or sets the desired tooltip behavior. 86 | */ 87 | @property (assign, nonatomic) FBSDKLoginButtonTooltipBehavior tooltipBehavior; 88 | /*! 89 | @abstract Gets or sets the desired tooltip color style. 90 | */ 91 | @property (assign, nonatomic) FBSDKTooltipColorStyle tooltipColorStyle; 92 | 93 | @end 94 | 95 | /*! 96 | @protocol 97 | @abstract A delegate for `FBSDKLoginButton` 98 | */ 99 | @protocol FBSDKLoginButtonDelegate 100 | 101 | /*! 102 | @abstract Sent to the delegate when the button was used to login. 103 | @param loginButton the sender 104 | @param result The results of the login 105 | @param error The error (if any) from the login 106 | */ 107 | - (void) loginButton:(FBSDKLoginButton *)loginButton 108 | didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result 109 | error:(NSError *)error; 110 | 111 | /*! 112 | @abstract Sent to the delegate when the button was used to logout. 113 | @param loginButton The button that was clicked. 114 | */ 115 | - (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton; 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKGraphErrorRecoveryProcessor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import "FBSDKConstants.h" 22 | 23 | @class FBSDKGraphErrorRecoveryProcessor; 24 | @class FBSDKGraphRequest; 25 | 26 | /*! 27 | @abstract Defines a delegate for `FBSDKGraphErrorRecoveryProcessor`. 28 | */ 29 | @protocol FBSDKGraphErrorRecoveryProcessorDelegate 30 | 31 | /*! 32 | @abstract Indicates the error recovery has been attempted. 33 | @param processor the processor instance. 34 | @param didRecover YES if the recovery was successful. 35 | @param error the error that that was attempted to be recovered from. 36 | */ 37 | - (void)processorDidAttemptRecovery:(FBSDKGraphErrorRecoveryProcessor *)processor didRecover:(BOOL)didRecover error:(NSError *)error; 38 | 39 | @optional 40 | /*! 41 | @abstract Indicates the processor is about to process the error. 42 | @param processor the processor instance. 43 | @param error the error is about to be processed. 44 | @discussion return NO if the processor should not process the error. For example, 45 | if you want to prevent alerts of localized messages but otherwise perform retries and recoveries, 46 | you could return NO for errors where userInfo[FBSDKGraphRequestErrorCategoryKey] equal to FBSDKGraphRequestErrorCategoryOther 47 | */ 48 | - (BOOL)processorWillProcessError:(FBSDKGraphErrorRecoveryProcessor *)processor error:(NSError *)error; 49 | 50 | @end 51 | 52 | /*! 53 | @abstract Defines a type that can process Facebook NSErrors with best practices. 54 | @discussion Facebook NSErrors can contain FBSDKErrorRecoveryAttempting instances to recover from errors, or 55 | localized messages to present to the user. This class will process the instances as follows: 56 | 57 | 1. If the error is temporary as indicated by FBSDKGraphRequestErrorCategoryKey, assume the recovery succeeded and 58 | notify the delegate. 59 | 2. If a FBSDKErrorRecoveryAttempting instance is available, display an alert (dispatched to main thread) 60 | with the recovery options and call the instance's [ attemptRecoveryFromError:optionIndex:...]. 61 | 3. If a FBSDKErrorRecoveryAttempting is not available, check the userInfo for FBSDKLocalizedErrorDescriptionKey 62 | and present that in an alert (dispatched to main thread). 63 | 64 | By default, FBSDKGraphRequests use this type to process errors and retry the request upon a successful 65 | recovery. 66 | 67 | Note that Facebook recovery attempters can present UI or even cause app switches (such as to login). Any such 68 | work is dispatched to the main thread (therefore your request handlers may then run on the main thread). 69 | 70 | Login recovery requires FBSDKLoginKit. Login will use FBSDKLoginBehaviorNative and will prompt the user 71 | for all permissions last granted. If any are declined on the new request, the recovery is not successful but 72 | the `[FBSDKAccessToken currentAccessToken]` might still have been updated. 73 | . 74 | */ 75 | @interface FBSDKGraphErrorRecoveryProcessor : NSObject 76 | 77 | /*! 78 | @abstract Gets the delegate. Note this is a strong reference, and is nil'ed out after recovery is complete. 79 | */ 80 | @property (nonatomic, strong, readonly) iddelegate; 81 | 82 | /*! 83 | @abstract Attempts to process the error, return YES if the error can be processed. 84 | @param error the error to process. 85 | @param request the relateed request that may be reissued. 86 | @param delegate the delegate that will be retained until recovery is complete. 87 | */ 88 | - (BOOL)processError:(NSError *)error request:(FBSDKGraphRequest *)request delegate:(id) delegate; 89 | 90 | /*! 91 | @abstract The callback for FBSDKErrorRecoveryAttempting 92 | @param didRecover if the recovery succeeded 93 | @param contextInfo unused 94 | */ 95 | - (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo; 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /LoadFacebookProfile.xcodeproj/xcshareddata/xcschemes/LoadFacebookProfileKit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 45 | 46 | 48 | 54 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 79 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 98 | 104 | 105 | 106 | 107 | 109 | 110 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /LoadFacebookProfile/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKTestUsersManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | @class FBSDKAccessToken; 22 | 23 | /*! 24 | @typedef 25 | 26 | @abstract Callback block for returning an array of FBSDKAccessToken instances (and possibly `NSNull` instances); or an error. 27 | */ 28 | typedef void (^FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)(NSArray *tokens, NSError *error) ; 29 | 30 | /*! 31 | @typedef 32 | 33 | @abstract Callback block for removing a test user. 34 | */ 35 | typedef void (^FBSDKTestUsersManagerRemoveTestAccountHandler)(NSError *error) ; 36 | 37 | 38 | /*! 39 | @class FBSDKTestUsersManager 40 | @abstract Provides methods for managing test accounts for testing Facebook integration. 41 | 42 | @discussion Facebook allows developers to create test accounts for testing their applications' 43 | Facebook integration (see https://developers.facebook.com/docs/test_users/). This class 44 | simplifies use of these accounts for writing tests. It is not designed for use in 45 | production application code. 46 | 47 | This class will make Graph API calls on behalf of your app to manage test accounts and requires 48 | an app id and app secret. You will typically use this class to write unit or integration tests. 49 | Make sure you NEVER include your app secret in your production app. 50 | */ 51 | @interface FBSDKTestUsersManager : NSObject 52 | 53 | /*! 54 | @abstract construct or return the shared instance 55 | @param appID the Facebook app id 56 | @param appSecret the Facebook app secret 57 | */ 58 | + (instancetype)sharedInstanceForAppID:(NSString *)appID appSecret:(NSString *)appSecret; 59 | 60 | /*! 61 | @abstract retrieve FBSDKAccessToken instances for test accounts with the specific permissions. 62 | @param arraysOfPermissions an array of permissions sets, such as @[ [NSSet setWithObject:@"email"], [NSSet setWithObject:@"user_birthday"]] 63 | if you needed two test accounts with email and birthday permissions, respectively. You can pass in empty nested sets 64 | if you need two arbitrary test accounts. For convenience, passing nil is treated as @[ [NSSet set] ] 65 | for fetching a single test user. 66 | @param createIfNotFound if YES, new test accounts are created if no test accounts existed that fit the permissions 67 | requirement 68 | @param handler the callback to invoke which will return an array of `FBAccessTokenData` instances or an `NSError`. 69 | If param `createIfNotFound` is NO, the array may contain `[NSNull null]` instances. 70 | 71 | @discussion If you are requesting test accounts with differing number of permissions, try to order 72 | `arrayOfPermissionsArrays` so that the most number of permissions come first to minimize creation of new 73 | test accounts. 74 | */ 75 | - (void)requestTestAccountTokensWithArraysOfPermissions:(NSArray *)arraysOfPermissions 76 | createIfNotFound:(BOOL)createIfNotFound 77 | completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; 78 | 79 | /*! 80 | @abstract add a test account with the specified permissions 81 | @param permissions the set of permissions, e.g., [NSSet setWithObjects:@"email", @"user_friends"] 82 | @param handler the callback handler 83 | */ 84 | - (void)addTestAccountWithPermissions:(NSSet *)permissions 85 | completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; 86 | 87 | /*! 88 | @abstract remove a test account for the given user id 89 | @param userId the user id 90 | @param handler the callback handler 91 | */ 92 | - (void)removeTestAccount:(NSString *)userId completionHandler:(FBSDKTestUsersManagerRemoveTestAccountHandler)handler; 93 | 94 | /*! 95 | @abstract Make two test users friends with each other. 96 | @param first the token of the first user 97 | @param second the token of the second user 98 | @param callback the callback handler 99 | */ 100 | - (void)makeFriendsWithFirst:(FBSDKAccessToken *)first second:(FBSDKAccessToken *)second callback:(void (^)(NSError *))callback; 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/Headers/FBSDKTooltipView.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | /*! 22 | @typedef FBSDKTooltipViewArrowDirection enum 23 | 24 | @abstract 25 | Passed on construction to determine arrow orientation. 26 | */ 27 | typedef NS_ENUM(NSUInteger, FBSDKTooltipViewArrowDirection) 28 | { 29 | /*! View is located above given point, arrow is pointing down. */ 30 | FBSDKTooltipViewArrowDirectionDown = 0, 31 | /*! View is located below given point, arrow is pointing up. */ 32 | FBSDKTooltipViewArrowDirectionUp = 1, 33 | }; 34 | 35 | /*! 36 | @typedef FBSDKTooltipColorStyle enum 37 | 38 | @abstract 39 | Passed on construction to determine color styling. 40 | */ 41 | typedef NS_ENUM(NSUInteger, FBSDKTooltipColorStyle) 42 | { 43 | /*! Light blue background, white text, faded blue close button. */ 44 | FBSDKTooltipColorStyleFriendlyBlue = 0, 45 | /*! Dark gray background, white text, light gray close button. */ 46 | FBSDKTooltipColorStyleNeutralGray = 1, 47 | }; 48 | 49 | /*! 50 | @class FBSDKTooltipView 51 | 52 | @abstract 53 | Tooltip bubble with text in it used to display tips for UI elements, 54 | with a pointed arrow (to refer to the UI element). 55 | 56 | @discussion 57 | The tooltip fades in and will automatically fade out. See `displayDuration`. 58 | */ 59 | @interface FBSDKTooltipView : UIView 60 | 61 | /*! 62 | @abstract Gets or sets the amount of time in seconds the tooltip should be displayed. 63 | 64 | @discussion Set this to zero to make the display permanent until explicitly dismissed. 65 | Defaults to six seconds. 66 | */ 67 | @property (nonatomic, assign) CFTimeInterval displayDuration; 68 | 69 | /*! 70 | @abstract Gets or sets the color style after initialization. 71 | 72 | @discussion Defaults to value passed to -initWithTagline:message:colorStyle:. 73 | */ 74 | @property (nonatomic, assign) FBSDKTooltipColorStyle colorStyle; 75 | 76 | /*! 77 | @abstract Gets or sets the message. 78 | */ 79 | @property (nonatomic, copy) NSString *message; 80 | 81 | /*! 82 | @abstract Gets or sets the optional phrase that comprises the first part of the label (and is highlighted differently). 83 | */ 84 | @property (nonatomic, copy) NSString *tagline; 85 | 86 | /*! 87 | @abstract 88 | Designated initializer. 89 | 90 | @param tagline First part of the label, that will be highlighted with different color. Can be nil. 91 | 92 | @param message Main message to display. 93 | 94 | @param colorStyle Color style to use for tooltip. 95 | 96 | @discussion 97 | If you need to show a tooltip for login, consider using the `FBSDKLoginTooltipView` view. 98 | 99 | @see FBSDKLoginTooltipView 100 | */ 101 | - (instancetype)initWithTagline:(NSString *)tagline message:(NSString *)message colorStyle:(FBSDKTooltipColorStyle)colorStyle; 102 | 103 | /*! 104 | @abstract 105 | Show tooltip at the top or at the bottom of given view. 106 | Tooltip will be added to anchorView.window.rootViewController.view 107 | 108 | @param anchorView view to show at, must be already added to window view hierarchy, in order to decide 109 | where tooltip will be shown. (If there's not enough space at the top of the anchorView in window bounds - 110 | tooltip will be shown at the bottom of it) 111 | 112 | @discussion 113 | Use this method to present the tooltip with automatic positioning or 114 | use -presentInView:withArrowPosition:direction: for manual positioning 115 | If anchorView is nil or has no window - this method does nothing. 116 | */ 117 | - (void)presentFromView:(UIView *)anchorView; 118 | 119 | /*! 120 | @abstract 121 | Adds tooltip to given view, with given position and arrow direction. 122 | 123 | @param view View to be used as superview. 124 | 125 | @param arrowPosition Point in view's cordinates, where arrow will be pointing 126 | 127 | @param arrowDirection whenever arrow should be pointing up (message bubble is below the arrow) or 128 | down (message bubble is above the arrow). 129 | */ 130 | - (void)presentInView:(UIView *)view withArrowPosition:(CGPoint)arrowPosition direction:(FBSDKTooltipViewArrowDirection)arrowDirection; 131 | 132 | /*! 133 | @abstract 134 | Remove tooltip manually. 135 | 136 | @discussion 137 | Calling this method isn't necessary - tooltip will dismiss itself automatically after the `displayDuration`. 138 | */ 139 | - (void)dismiss; 140 | 141 | @end 142 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKGraphRequest.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | @class FBSDKAccessToken; 24 | 25 | /*! 26 | @abstract Represents a request to the Facebook Graph API. 27 | 28 | @discussion `FBSDKGraphRequest` encapsulates the components of a request (the 29 | Graph API path, the parameters, error recovery behavior) and should be 30 | used in conjunction with `FBSDKGraphRequestConnection` to issue the request. 31 | 32 | Nearly all Graph APIs require an access token. Unless specified, the 33 | `[FBSDKAccessToken currentAccessToken]` is used. Therefore, most requests 34 | will require login first (see `FBSDKLoginManager` in FBSDKLoginKit.framework). 35 | 36 | A `- start` method is provided for convenience for single requests. 37 | 38 | By default, FBSDKGraphRequest will attempt to recover any errors returned from 39 | Facebook. You can disable this via `disableErrorRecovery:`. 40 | @see FBSDKGraphErrorRecoveryProcessor 41 | */ 42 | @interface FBSDKGraphRequest : NSObject 43 | 44 | /*! 45 | @abstract Initializes a new instance that use use `[FBSDKAccessToken currentAccessToken]`. 46 | @param graphPath the graph path (e.g., @"me"). 47 | @param parameters the optional parameters dictionary. 48 | */ 49 | - (instancetype)initWithGraphPath:(NSString *)graphPath 50 | parameters:(NSDictionary *)parameters; 51 | 52 | /*! 53 | @abstract Initializes a new instance that use use `[FBSDKAccessToken currentAccessToken]`. 54 | @param graphPath the graph path (e.g., @"me"). 55 | @param parameters the optional parameters dictionary. 56 | @param HTTPMethod the optional HTTP method. nil defaults to @"GET". 57 | */ 58 | - (instancetype)initWithGraphPath:(NSString *)graphPath 59 | parameters:(NSDictionary *)parameters 60 | HTTPMethod:(NSString *)HTTPMethod; 61 | 62 | /*! 63 | @abstract Initializes a new instance. 64 | @param graphPath the graph path (e.g., @"me"). 65 | @param parameters the optional parameters dictionary. 66 | @param tokenString the token string to use. Specifying nil will cause no token to be used. 67 | @param version the optional Graph API version (e.g., @"v2.0"). nil defaults to FBSDK_TARGET_PLATFORM_VERSION. 68 | @param HTTPMethod the optional HTTP method (e.g., @"POST"). nil defaults to @"GET". 69 | */ 70 | - (instancetype)initWithGraphPath:(NSString *)graphPath 71 | parameters:(NSDictionary *)parameters 72 | tokenString:(NSString *)tokenString 73 | version:(NSString *)version 74 | HTTPMethod:(NSString *)HTTPMethod 75 | NS_DESIGNATED_INITIALIZER; 76 | 77 | /*! 78 | @abstract The request parameters. 79 | */ 80 | @property (nonatomic, strong, readonly) NSMutableDictionary *parameters; 81 | 82 | /*! 83 | @abstract The access token string used by the request. 84 | */ 85 | @property (nonatomic, copy, readonly) NSString *tokenString; 86 | 87 | /*! 88 | @abstract The Graph API endpoint to use for the request, for example "me". 89 | */ 90 | @property (nonatomic, copy, readonly) NSString *graphPath; 91 | 92 | /*! 93 | @abstract The HTTPMethod to use for the request, for example "GET" or "POST". 94 | */ 95 | @property (nonatomic, copy, readonly) NSString *HTTPMethod; 96 | 97 | /*! 98 | @abstract The Graph API version to use (e.g., "v2.0") 99 | */ 100 | @property (nonatomic, copy, readonly) NSString *version; 101 | 102 | /*! 103 | @abstract If set, disables the automatic error recovery mechanism. 104 | @param disable whether to disable the automatic error recovery mechanism 105 | @discussion By default, non-batched FBSDKGraphRequest instances will automatically try to recover 106 | from errors by constructing a `FBSDKGraphErrorRecoveryProcessor` instance that 107 | re-issues the request on successful recoveries. The re-issued request will call the same 108 | handler as the receiver but may occur with a different `FBSDKGraphRequestConnection` instance. 109 | 110 | This will override [FBSDKSettings setGraphErrorRecoveryDisabled:]. 111 | */ 112 | - (void)setGraphErrorRecoveryDisabled:(BOOL)disable; 113 | 114 | /*! 115 | @abstract Starts a connection to the Graph API. 116 | @param handler The handler block to call when the request completes. 117 | */ 118 | - (FBSDKGraphRequestConnection *)startWithCompletionHandler:(FBSDKGraphRequestHandler)handler; 119 | 120 | @end 121 | -------------------------------------------------------------------------------- /LoadFacebookProfileKit/FacebookUserLoader.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import FBSDKLoginKit 3 | 4 | /** 5 | 6 | Load user profile information from Facebook. 7 | 8 | */ 9 | public class FacebookUserLoader { 10 | 11 | private var _loginManager: FBSDKLoginManager? 12 | 13 | private var loginManager: FBSDKLoginManager? { 14 | get { 15 | if FacebookUserLoader.isSimulated { return nil } 16 | 17 | if _loginManager == nil { 18 | _loginManager = FBSDKLoginManager() 19 | } 20 | 21 | return _loginManager 22 | } 23 | } 24 | 25 | private var currentConnection: FBSDKGraphRequestConnection? 26 | 27 | public init() { } 28 | 29 | deinit { 30 | cancel() 31 | } 32 | 33 | /** 34 | 35 | Loads Facebook user profile. 36 | 37 | - parameter askEmail: If true we ask Facebook to return user's email. User may reject this request and return no email. 38 | - parameter onError: A function that will be called in case of any error. It will also be called if users cancells the Facebook login. 39 | - parameter onSuccess: A function that will be called after user authenticates with Facebook. A user profile information is passed to the function.\ 40 | */ 41 | public func load(askEmail askEmail: Bool, onError:()->(), onSuccess: (TegFacebookUser)->()) { 42 | if FacebookUserLoader.isSimulated { 43 | FacebookUserLoader.simulateError(onError) 44 | FacebookUserLoader.simulateSuccess(onSuccess) 45 | return 46 | } 47 | 48 | cancel() 49 | logOut() 50 | logInAndLoadUserProfile(askEmail, onError: onError, onSuccess: onSuccess) 51 | } 52 | 53 | func cancel() { 54 | currentConnection?.cancel() 55 | currentConnection = nil 56 | } 57 | 58 | private func logInAndLoadUserProfile(askEmail: Bool, onError: ()->(), 59 | onSuccess: (TegFacebookUser)->()) { 60 | 61 | var permissions = ["public_profile"] 62 | 63 | if askEmail { 64 | permissions.append("email") 65 | } 66 | 67 | loginManager?.logInWithReadPermissions(permissions) { [weak self] result, error in 68 | if error != nil { 69 | onError() 70 | return 71 | } 72 | 73 | if result.isCancelled { 74 | onError() 75 | return 76 | } 77 | 78 | self?.loadFacebookMeInfo(onError, onSuccess: onSuccess) 79 | } 80 | } 81 | 82 | private func logOut() { 83 | loginManager?.logOut() 84 | } 85 | 86 | /// Loads user profile information from Facebook. 87 | private func loadFacebookMeInfo(onError: ()->(), onSuccess: (TegFacebookUser) -> ()) { 88 | if FBSDKAccessToken.currentAccessToken() == nil { 89 | onError() 90 | return 91 | } 92 | 93 | let graphRequest = FBSDKGraphRequest(graphPath: "me", parameters: nil) 94 | 95 | currentConnection = graphRequest.startWithCompletionHandler { [weak self] connection, result, error in 96 | if error != nil { 97 | onError() 98 | return 99 | } 100 | 101 | if let userData = result as? NSDictionary, 102 | accessToken = self?.accessToken, 103 | user = FacebookUserLoader.parseMeData(userData, accessToken: accessToken) { 104 | 105 | onSuccess(user) 106 | } else { 107 | onError() 108 | } 109 | } 110 | } 111 | 112 | 113 | /// Parses user profile dictionary returned by Facebook SDK. 114 | class func parseMeData(data: NSDictionary, accessToken: String) -> TegFacebookUser? { 115 | if let id = data["id"] as? String { 116 | return TegFacebookUser( 117 | id: id, 118 | accessToken: accessToken, 119 | email: data["email"] as? String, 120 | firstName: data["first_name"] as? String, 121 | lastName: data["last_name"] as? String, 122 | name: data["name"] as? String) 123 | } 124 | 125 | return nil 126 | } 127 | 128 | private var accessToken: String? { 129 | return FBSDKAccessToken.currentAccessToken().tokenString 130 | } 131 | 132 | // MARK: - Simulation for tests 133 | // ------------------------------- 134 | 135 | /** 136 | 137 | If present, the `load` method will call `onSuccess` function with the supplied user without touching Facebook SDK. Used in tests. 138 | 139 | */ 140 | public static var simulateSuccessUser: TegFacebookUser? 141 | 142 | /// If true the `load` method will call `onError` function without touching Facebook SDK. Used in tests. 143 | public static var simulateError = false 144 | 145 | /// Delay used to simulate Facebook response. If 0 response is returned synchronously. 146 | public static var simulateLoadAfterDelay = 0.1 147 | 148 | 149 | private class func simulateSuccess(onSuccess: (TegFacebookUser)->()) { 150 | if let successUser = simulateSuccessUser { 151 | runAfterDelay(simulateLoadAfterDelay) { onSuccess(successUser) } 152 | } 153 | } 154 | 155 | private class func simulateError(onError: ()->()) { 156 | if simulateError { 157 | runAfterDelay(simulateLoadAfterDelay) { onError() } 158 | } 159 | } 160 | 161 | /// Runs the block after the delay. If delay is 0 the block is called synchronously. 162 | private class func runAfterDelay(delaySeconds: Double, block: ()->()) { 163 | if delaySeconds == 0 { 164 | block() 165 | } else { 166 | let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delaySeconds * Double(NSEC_PER_SEC))) 167 | dispatch_after(time, dispatch_get_main_queue(), block) 168 | } 169 | } 170 | 171 | /// Check if we are currently simulating the facebook loading, which is used in unit test. 172 | private static var isSimulated: Bool { 173 | if simulateSuccessUser != nil { return true } 174 | if simulateError { return true } 175 | return false 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKProfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import "FBSDKMacros.h" 20 | #import "FBSDKProfilePictureView.h" 21 | 22 | /*! 23 | @abstract Notification indicating that the `currentProfile` has changed. 24 | @discussion the userInfo dictionary of the notification will contain keys 25 | `FBSDKProfileChangeOldKey` and 26 | `FBSDKProfileChangeNewKey`. 27 | */ 28 | FBSDK_EXTERN NSString *const FBSDKProfileDidChangeNotification; 29 | 30 | /* @abstract key in notification's userInfo object for getting the old profile. 31 | @discussion If there was no old profile, the key will not be present. 32 | */ 33 | FBSDK_EXTERN NSString *const FBSDKProfileChangeOldKey; 34 | 35 | /* @abstract key in notification's userInfo object for getting the new profile. 36 | @discussion If there is no new profile, the key will not be present. 37 | */ 38 | FBSDK_EXTERN NSString *const FBSDKProfileChangeNewKey; 39 | 40 | /*! 41 | @abstract Represents an immutable Facebook profile 42 | @discussion This class provides a global "currentProfile" instance to more easily 43 | add social context to your application. When the profile changes, a notification is 44 | posted so that you can update relevant parts of your UI and is persisted to NSUserDefaults. 45 | 46 | Typically, you will want to call `enableUpdatesOnAccessTokenChange:YES` so that 47 | it automatically observes changes to the `[FBSDKAccessToken currentAccessToken]`. 48 | 49 | You can use this class to build your own `FBSDKProfilePictureView` or in place of typical requests to "/me". 50 | */ 51 | @interface FBSDKProfile : NSObject 52 | 53 | /*! 54 | @abstract initializes a new instance. 55 | @param userID the user ID 56 | @param firstName the user's first name 57 | @param middleName the user's middle name 58 | @param lastName the user's last name 59 | @param name the user's complete name 60 | @param linkURL the link for this profile 61 | @param refreshDate the optional date this profile was fetched. Defaults to [NSDate date]. 62 | */ 63 | - (instancetype)initWithUserID:(NSString *)userID 64 | firstName:(NSString *)firstName 65 | middleName:(NSString *)middleName 66 | lastName:(NSString *)lastName 67 | name:(NSString *)name 68 | linkURL:(NSURL *)linkURL 69 | refreshDate:(NSDate *)refreshDate NS_DESIGNATED_INITIALIZER; 70 | /*! 71 | @abstract The user id 72 | */ 73 | @property (nonatomic, readonly) NSString *userID; 74 | /*! 75 | @abstract The user's first name 76 | */ 77 | @property (nonatomic, readonly) NSString *firstName; 78 | /*! 79 | @abstract The user's middle name 80 | */ 81 | @property (nonatomic, readonly) NSString *middleName; 82 | /*! 83 | @abstract The user's last name 84 | */ 85 | @property (nonatomic, readonly) NSString *lastName; 86 | /*! 87 | @abstract The user's complete name 88 | */ 89 | @property (nonatomic, readonly) NSString *name; 90 | /*! 91 | @abstract A URL to the user's profile. 92 | @discussion Consider using Bolts and `FBSDKAppLinkResolver` to resolve this 93 | to an app link to link directly to the user's profile in the Facebook app. 94 | */ 95 | @property (nonatomic, readonly) NSURL *linkURL; 96 | 97 | /*! 98 | @abstract The last time the profile data was fetched. 99 | */ 100 | @property (nonatomic, readonly) NSDate *refreshDate; 101 | 102 | /*! 103 | @abstract Gets the current FBSDKProfile instance. 104 | */ 105 | + (FBSDKProfile *)currentProfile; 106 | 107 | /*! 108 | @abstract Sets the current instance and posts the appropriate notification if the profile parameter is different 109 | than the receiver. 110 | @param profile the profile to set 111 | @discussion This persists the profile to NSUserDefaults. 112 | */ 113 | + (void)setCurrentProfile:(FBSDKProfile *)profile; 114 | 115 | /*! 116 | @abstract Indicates if `currentProfile` will automatically observe `FBSDKAccessTokenDidChangeNotification` notifications 117 | @param enable YES is observing 118 | @discussion If observing, this class will issue a graph request for public profile data when the current token's userID 119 | differs from the current profile. You can observe `FBSDKProfileDidChangeNotification` for when the profile is updated. 120 | 121 | Note that if `[FBSDKAccessToken currentAccessToken]` is unset, the `currentProfile` instance remains. It's also possible 122 | for `currentProfile` to return nil until the data is fetched. 123 | */ 124 | + (void)enableUpdatesOnAccessTokenChange:(BOOL)enable; 125 | 126 | /*! 127 | @abstract A convenience method for returning a Graph API path for retrieving the user's profile image. 128 | @discussion You can pass this to a `FBSDKGraphRequest` instance to download the image. 129 | @param mode The picture mode 130 | @param size The height and width. This will be rounded to integer precision. 131 | */ 132 | - (NSString *)imagePathForPictureMode:(FBSDKProfilePictureMode)mode size:(CGSize)size; 133 | 134 | /*! 135 | @abstract Returns YES if the profile is equivalent to the receiver. 136 | @param profile the profile to compare to. 137 | */ 138 | - (BOOL)isEqualToProfile:(FBSDKProfile *)profile; 139 | @end 140 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKAccessToken.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | #import 23 | #import 24 | 25 | /*! 26 | @abstract Notification indicating that the `currentAccessToken` has changed. 27 | @discussion the userInfo dictionary of the notification will contain keys 28 | `FBSDKAccessTokenChangeOldKey` and 29 | `FBSDKAccessTokenChangeNewKey`. 30 | */ 31 | FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeNotification; 32 | 33 | /*! 34 | @abstract A key in the notification's userInfo that will be set 35 | if and only if the user ID changed between the old and new tokens. 36 | @discussion Token refreshes can occur automatically with the SDK 37 | which do not change the user. If you're only interested in user 38 | changes (such as logging out), you should check for the existence 39 | of this key. The value is a NSNumber with a boolValue. 40 | */ 41 | FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeUserID; 42 | 43 | /* 44 | @abstract key in notification's userInfo object for getting the old token. 45 | @discussion If there was no old token, the key will not be present. 46 | */ 47 | FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeOldKey; 48 | 49 | /* 50 | @abstract key in notification's userInfo object for getting the new token. 51 | @discussion If there is no new token, the key will not be present. 52 | */ 53 | FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeNewKey; 54 | 55 | 56 | /*! 57 | @class FBSDKAccessToken 58 | @abstract Represents an immutable access token for using Facebook services. 59 | */ 60 | @interface FBSDKAccessToken : NSObject 61 | 62 | /*! 63 | @abstract Returns the app ID. 64 | */ 65 | @property (readonly, copy, nonatomic) NSString *appID; 66 | 67 | /*! 68 | @abstract Returns the known declined permissions. 69 | */ 70 | @property (readonly, copy, nonatomic) NSSet *declinedPermissions; 71 | 72 | /*! 73 | @abstract Returns the expiration date. 74 | */ 75 | @property (readonly, copy, nonatomic) NSDate *expirationDate; 76 | 77 | /*! 78 | @abstract Returns the known granted permissions. 79 | */ 80 | @property (readonly, copy, nonatomic) NSSet *permissions; 81 | 82 | /*! 83 | @abstract Returns the date the token was last refreshed. 84 | */ 85 | @property (readonly, copy, nonatomic) NSDate *refreshDate; 86 | 87 | /*! 88 | @abstract Returns the opaque token string. 89 | */ 90 | @property (readonly, copy, nonatomic) NSString *tokenString; 91 | 92 | /*! 93 | @abstract Returns the user ID. 94 | */ 95 | @property (readonly, copy, nonatomic) NSString *userID; 96 | 97 | /*! 98 | @abstract Initializes a new instance. 99 | @param tokenString the opaque token string. 100 | @param permissions the granted permissions. Note this is converted to NSSet and is only 101 | an NSArray for the convenience of literal syntax. 102 | @param declinedPermissions the declined permissions. Note this is converted to NSSet and is only 103 | an NSArray for the convenience of literal syntax. 104 | @param appID the app ID. 105 | @param userID the user ID. 106 | @param expirationDate the optional expiration date (defaults to distantFuture). 107 | @param refreshDate the optional date the token was last refreshed (defaults to today). 108 | @discussion This initializer should only be used for advanced apps that 109 | manage tokens explicitly. Typical login flows only need to use `FBSDKLoginManager` 110 | along with `+currentAccessToken`. 111 | */ 112 | - (instancetype)initWithTokenString:(NSString *)tokenString 113 | permissions:(NSArray *)permissions 114 | declinedPermissions:(NSArray *)declinedPermissions 115 | appID:(NSString *)appID 116 | userID:(NSString *)userID 117 | expirationDate:(NSDate *)expirationDate 118 | refreshDate:(NSDate *)refreshDate 119 | NS_DESIGNATED_INITIALIZER; 120 | 121 | /*! 122 | @abstract Convenience getter to determine if a permission has been granted 123 | @param permission The permission to check. 124 | */ 125 | - (BOOL)hasGranted:(NSString *)permission; 126 | 127 | /*! 128 | @abstract Compares the receiver to another FBSDKAccessToken 129 | @param token The other token 130 | @return YES if the receiver's values are equal to the other token's values; otherwise NO 131 | */ 132 | - (BOOL)isEqualToAccessToken:(FBSDKAccessToken *)token; 133 | 134 | /*! 135 | @abstract Returns the "global" access token that represents the currently logged in user. 136 | @discussion The `currentAccessToken` is a convenient representation of the token of the 137 | current user and is used by other SDK components (like `FBSDKLoginManager`). 138 | */ 139 | + (FBSDKAccessToken *)currentAccessToken; 140 | 141 | /*! 142 | @abstract Sets the "global" access token that represents the currently logged in user. 143 | @param token The access token to set. 144 | @discussion This will broadcast a notification and save the token to the app keychain. 145 | */ 146 | + (void)setCurrentAccessToken:(FBSDKAccessToken *)token; 147 | 148 | /*! 149 | @abstract Refresh the current access token's permission state and extend the token's expiration date, 150 | if possible. 151 | @param completionHandler an optional callback handler that can surface any errors related to permission refreshing. 152 | @discussion On a successful refresh, the currentAccessToken will be updated so you typically only need to 153 | observe the `FBSDKAccessTokenDidChangeNotification` notification. 154 | 155 | If a token is already expired, it cannot be refreshed. 156 | */ 157 | + (void)refreshCurrentAccessToken:(FBSDKGraphRequestHandler)completionHandler; 158 | 159 | @end 160 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKConstants.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | /*! 24 | @abstract The error domain for all errors from FBSDKCoreKit. 25 | @discussion Error codes from the SDK in the range 0-99 are reserved for this domain. 26 | */ 27 | FBSDK_EXTERN NSString *const FBSDKErrorDomain; 28 | 29 | /*! 30 | @typedef NS_ENUM(NSInteger, FBSDKErrorCode) 31 | @abstract Error codes for FBSDKErrorDomain. 32 | */ 33 | typedef NS_ENUM(NSInteger, FBSDKErrorCode) 34 | { 35 | /*! 36 | @abstract Reserved. 37 | */ 38 | FBSDKReservedErrorCode = 0, 39 | 40 | /*! 41 | @abstract The error code for errors from invalid encryption on incoming encryption URLs. 42 | */ 43 | FBSDKEncryptionErrorCode, 44 | 45 | /*! 46 | @abstract The error code for errors from invalid arguments to SDK methods. 47 | */ 48 | FBSDKInvalidArgumentErrorCode, 49 | 50 | /*! 51 | @abstract The error code for unknown errors. 52 | */ 53 | FBSDKUnknownErrorCode, 54 | 55 | /*! 56 | @abstract A request failed due to a network error. Use NSUnderlyingErrorKey to retrieve 57 | the error object from the NSURLConnection for more information. 58 | */ 59 | FBSDKNetworkErrorCode, 60 | 61 | /*! 62 | @abstract The error code for errors encounted during an App Events flush. 63 | */ 64 | FBSDKAppEventsFlushErrorCode, 65 | 66 | /*! 67 | @abstract An endpoint that returns a binary response was used with FBSDKGraphRequestConnection. 68 | @discussion Endpoints that return image/jpg, etc. should be accessed using NSURLRequest 69 | */ 70 | FBSDKGraphRequestNonTextMimeTypeReturnedErrorCode, 71 | 72 | /*! 73 | @abstract The operation failed because the server returned an unexpected response. 74 | @discussion You can get this error if you are not using the most recent SDK, or you are accessing a version of the 75 | Graph API incompatible with the current SDK. 76 | */ 77 | FBSDKGraphRequestProtocolMismatchErrorCode, 78 | 79 | /*! 80 | @abstract The Graph API returned an error. 81 | @discussion See below for useful userInfo keys (beginning with FBSDKGraphRequestError*) 82 | */ 83 | FBSDKGraphRequestGraphAPIErrorCode, 84 | 85 | /*! 86 | @abstract The specified dialog configuration is not available. 87 | @discussion This error may signify that the configuration for the dialogs has not yet been downloaded from the server 88 | or that the dialog is unavailable. Subsequent attempts to use the dialog may succeed as the configuration is loaded. 89 | */ 90 | FBSDKDialogUnavailableErrorCode, 91 | }; 92 | 93 | /*! 94 | @typedef NS_ENUM(NSUInteger, FBSDKGraphRequestErrorCategory) 95 | @abstract Describes the category of Facebook error. See `FBSDKGraphRequestErrorCategoryKey`. 96 | */ 97 | typedef NS_ENUM(NSUInteger, FBSDKGraphRequestErrorCategory) 98 | { 99 | /*! The default error category that is not known to be recoverable. Check `FBSDKLocalizedErrorDescriptionKey` for a user facing message. */ 100 | FBSDKGraphRequestErrorCategoryOther = 0, 101 | /*! Indicates the error is temporary (such as server throttling). While a recoveryAttempter will be provided with the error instance, the attempt is guaranteed to succeed so you can simply retry the operation if you do not want to present an alert. */ 102 | FBSDKGraphRequestErrorCategoryTransient = 1, 103 | /*! Indicates the error can be recovered (such as requiring a login). A recoveryAttempter will be provided with the error instance that can take UI action. */ 104 | FBSDKGraphRequestErrorCategoryRecoverable = 2 105 | }; 106 | 107 | /* 108 | @methodgroup error userInfo keys 109 | */ 110 | 111 | /*! 112 | @abstract The userInfo key for the invalid collection for errors with FBSDKInvalidArgumentErrorCode. 113 | @discussion If the invalid argument is a collection, the collection can be found with this key and the individual 114 | invalid item can be found with FBSDKErrorArgumentValueKey. 115 | */ 116 | FBSDK_EXTERN NSString *const FBSDKErrorArgumentCollectionKey; 117 | 118 | /*! 119 | @abstract The userInfo key for the invalid argument name for errors with FBSDKInvalidArgumentErrorCode. 120 | */ 121 | FBSDK_EXTERN NSString *const FBSDKErrorArgumentNameKey; 122 | 123 | /*! 124 | @abstract The userInfo key for the invalid argument value for errors with FBSDKInvalidArgumentErrorCode. 125 | */ 126 | FBSDK_EXTERN NSString *const FBSDKErrorArgumentValueKey; 127 | 128 | /*! 129 | @abstract The userInfo key for the message for developers in NSErrors that originate from the SDK. 130 | @discussion The developer message will not be localized and is not intended to be presented within the app. 131 | */ 132 | FBSDK_EXTERN NSString *const FBSDKErrorDeveloperMessageKey; 133 | 134 | /*! 135 | @abstract The userInfo key describing a localized description that can be presented to the user. 136 | */ 137 | FBSDK_EXTERN NSString *const FBSDKErrorLocalizedDescriptionKey; 138 | 139 | /*! 140 | @abstract The userInfo key describing a localized title that can be presented to the user, used with `FBSDKLocalizedErrorDescriptionKey`. 141 | */ 142 | FBSDK_EXTERN NSString *const FBSDKErrorLocalizedTitleKey; 143 | 144 | /* 145 | @methodgroup FBSDKGraphRequest error userInfo keys 146 | */ 147 | 148 | /*! 149 | @abstract The userInfo key describing the error category, for error recovery purposes. 150 | @discussion See `FBSDKGraphErrorRecoveryProcessor` and `[FBSDKGraphRequest disableErrorRecovery]`. 151 | */ 152 | FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorCategoryKey; 153 | 154 | /* 155 | @abstract The userInfo key for the Graph API error code. 156 | */ 157 | FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorGraphErrorCode; 158 | 159 | /* 160 | @abstract The userInfo key for the Graph API error subcode. 161 | */ 162 | FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorGraphErrorSubcode; 163 | 164 | /* 165 | @abstract The userInfo key for the HTTP status code. 166 | */ 167 | FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorHTTPStatusCodeKey; 168 | 169 | /* 170 | @abstract The userInfo key for the raw JSON response. 171 | */ 172 | FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorParsedJSONResponseKey; 173 | 174 | /*! 175 | @abstract a formal protocol very similar to the informal protocol NSErrorRecoveryAttempting 176 | */ 177 | @protocol FBSDKErrorRecoveryAttempting 178 | 179 | /*! 180 | @abstract attempt the recovery 181 | @param error the error 182 | @param recoveryOptionIndex the selected option index 183 | @param delegate the delegate 184 | @param didRecoverSelector the callback selector, see discussion. 185 | @param contextInfo context info to pass back to callback selector, see discussion. 186 | @discussion 187 | Given that an error alert has been presented document-modally to the user, and the user has chosen one of the error's recovery options, attempt recovery from the error, and send the selected message to the specified delegate. The option index is an index into the error's array of localized recovery options. The method selected by didRecoverSelector must have the same signature as: 188 | 189 | - (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo; 190 | 191 | The value passed for didRecover must be YES if error recovery was completely successful, NO otherwise. 192 | */ 193 | - (void)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex delegate:(id)delegate didRecoverSelector:(SEL)didRecoverSelector contextInfo:(void *)contextInfo; 194 | 195 | @end 196 | -------------------------------------------------------------------------------- /Frameworks/FBSDKLoginKit.framework/Headers/FBSDKLoginManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | #import 21 | 22 | @class FBSDKLoginManagerLoginResult; 23 | 24 | /*! 25 | @abstract Describes the call back to the FBSDKLoginManager 26 | @param result the result of the authorization 27 | @param error the authorization error, if any. 28 | */ 29 | typedef void (^FBSDKLoginManagerRequestTokenHandler)(FBSDKLoginManagerLoginResult *result, NSError *error); 30 | 31 | 32 | /*! 33 | @typedef FBSDKDefaultAudience enum 34 | 35 | @abstract 36 | Passed to open to indicate which default audience to use for sessions that post data to Facebook. 37 | 38 | @discussion 39 | Certain operations such as publishing a status or publishing a photo require an audience. When the user 40 | grants an application permission to perform a publish operation, a default audience is selected as the 41 | publication ceiling for the application. This enumerated value allows the application to select which 42 | audience to ask the user to grant publish permission for. 43 | */ 44 | typedef NS_ENUM(NSUInteger, FBSDKDefaultAudience) 45 | { 46 | /*! Indicates that the user's friends are able to see posts made by the application */ 47 | FBSDKDefaultAudienceFriends = 0, 48 | /*! Indicates that only the user is able to see posts made by the application */ 49 | FBSDKDefaultAudienceOnlyMe, 50 | /*! Indicates that all Facebook users are able to see posts made by the application */ 51 | FBSDKDefaultAudienceEveryone, 52 | }; 53 | 54 | /*! 55 | @typedef FBSDKLoginBehavior enum 56 | 57 | @abstract 58 | Passed to the \c FBSDKLoginManager to indicate how Facebook Login should be attempted. 59 | 60 | @discussion 61 | Facebook Login authorizes the application to act on behalf of the user, using the user's 62 | Facebook account. Usually a Facebook Login will rely on an account maintained outside of 63 | the application, by the native Facebook application, the browser, or perhaps the device 64 | itself. This avoids the need for a user to enter their username and password directly, and 65 | provides the most secure and lowest friction way for a user to authorize the application to 66 | interact with Facebook. 67 | 68 | The \c FBSDKLoginBehavior enum specifies which log in method should be attempted. Most 69 | applications will use the default, which attempts a login through the Facebook app and falls 70 | back to the browser if needed. 71 | 72 | If log in cannot be completed using the specificed behavior, the completion handler will 73 | be invoked with an error in the \c FBSDKErrorDomain and a code of \c FBSDKLoginUnknownErrorCode. 74 | */ 75 | typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior) 76 | { 77 | /*! 78 | @abstract Attempts log in through the native Facebook app. If the Facebook app is 79 | not installed on the device, falls back to \c FBSDKLoginBehaviorBrowser. This is the 80 | default behavior. 81 | */ 82 | FBSDKLoginBehaviorNative = 0, 83 | /*! 84 | @abstract Attempts log in through the Safari browser 85 | */ 86 | FBSDKLoginBehaviorBrowser, 87 | /*! 88 | @abstract Attempts log in through the Facebook account currently signed in through Settings. 89 | If no Facebook account is signed in, falls back to \c FBSDKLoginBehaviorNative. 90 | */ 91 | FBSDKLoginBehaviorSystemAccount, 92 | /*! 93 | @abstract Attemps log in through a modal \c UIWebView pop up 94 | 95 | @note This behavior is only available to certain types of apps. Please check the Facebook 96 | Platform Policy to verify your app meets the restrictions. 97 | */ 98 | FBSDKLoginBehaviorWeb, 99 | }; 100 | 101 | /*! 102 | @abstract `FBSDKLoginManager` provides methods for logging the user in and out. 103 | @discussion `FBSDKLoginManager` works directly with `[FBSDKAccessToken currentAccessToken]` and 104 | sets the "currentAccessToken" upon successful authorizations (or sets `nil` in case of `logOut`). 105 | 106 | You should check `[FBSDKAccessToken currentAccessToken]` before calling logIn* to see if there is 107 | a cached token available (typically in your viewDidLoad). 108 | 109 | If you are managing your own token instances outside of "currentAccessToken", you will need to set 110 | "currentAccessToken" before calling logIn* to authorize futher permissions on your tokens. 111 | */ 112 | @interface FBSDKLoginManager : NSObject 113 | 114 | /*! 115 | @abstract the default audience. 116 | @discussion you should set this if you intend to ask for publish permissions. 117 | */ 118 | @property (assign, nonatomic) FBSDKDefaultAudience defaultAudience; 119 | 120 | /*! 121 | @abstract the login behavior 122 | @discussion you should only set this if you want an explicit login flow; otherwise, the SDK 123 | will automatically determine the best flow available. 124 | */ 125 | @property (assign, nonatomic) FBSDKLoginBehavior loginBehavior; 126 | 127 | /*! 128 | @abstract Logs the user in or authorizes additional permissions. 129 | @param permissions the optional array of permissions. Note this is converted to NSSet and is only 130 | an NSArray for the convenience of literal syntax. 131 | @param handler the callback. 132 | @discussion Use this method when asking for read permissions. You should only ask for permissions when they 133 | are needed and explain the value to the user. You can inspect the result.declinedPermissions to also 134 | provide more information to the user if they decline permissions. 135 | 136 | If `[FBSDKAccessToken currentAccessToken]` is not nil, it will be treated as a reauthorization for that user 137 | and will pass the "rerequest" flag to the login dialog. 138 | 139 | This method will present UI the user. You typically should check if `[FBSDKAccessToken currentAccessToken]` 140 | already contains the permissions you need before asking to reduce unnecessary app switching. For example, 141 | you could make that check at viewDidLoad. 142 | */ 143 | - (void)logInWithReadPermissions:(NSArray *)permissions handler:(FBSDKLoginManagerRequestTokenHandler)handler; 144 | 145 | /*! 146 | @abstract Logs the user in or authorizes additional permissions. 147 | @param permissions the optional array of permissions. Note this is converted to NSSet and is only 148 | an NSArray for the convenience of literal syntax. 149 | @param handler the callback. 150 | @discussion Use this method when asking for publish permissions. You should only ask for permissions when they 151 | are needed and explain the value to the user. You can inspect the result.declinedPermissions to also 152 | provide more information to the user if they decline permissions. 153 | 154 | If `[FBSDKAccessToken currentAccessToken]` is not nil, it will be treated as a reauthorization for that user 155 | and will pass the "rerequest" flag to the login dialog. 156 | 157 | This method will present UI the user. You typically should check if `[FBSDKAccessToken currentAccessToken]` 158 | already contains the permissions you need before asking to reduce unnecessary app switching. For example, 159 | you could make that check at viewDidLoad. 160 | */ 161 | - (void)logInWithPublishPermissions:(NSArray *)permissions handler:(FBSDKLoginManagerRequestTokenHandler)handler; 162 | 163 | /*! 164 | @abstract Logs the user out 165 | @discussion This calls [FBSDKAccessToken setCurrentAccessToken:nil] and [FBSDKProfile setCurrentProfile:nil]. 166 | */ 167 | - (void)logOut; 168 | 169 | /*! 170 | @method 171 | 172 | @abstract Issues an asychronous renewCredentialsForAccount call to the device's Facebook account store. 173 | 174 | @param handler The completion handler to call when the renewal is completed. This can be invoked on an arbitrary thread. 175 | 176 | @discussion This can be used to explicitly renew account credentials and is provided as a convenience wrapper around 177 | `[ACAccountStore renewCredentialsForAccount:completion]`. Note the method will not issue the renewal call if the the 178 | Facebook account has not been set on the device, or if access had not been granted to the account (though the handler 179 | wil receive an error). 180 | 181 | If the `[FBSDKAccessToken currentAccessToken]` was from the account store, a succesful renewal will also set 182 | a new "currentAccessToken". 183 | */ 184 | + (void)renewSystemCredentials:(void (^)(ACAccountCredentialRenewResult result, NSError *error))handler; 185 | 186 | @end 187 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKSettings.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | /* 24 | * Constants defining logging behavior. Use with <[FBSDKSettings setLoggingBehavior]>. 25 | */ 26 | 27 | /*! Include access token in logging. */ 28 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorAccessTokens; 29 | 30 | /*! Log performance characteristics */ 31 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorPerformanceCharacteristics; 32 | 33 | /*! Log FBSDKAppEvents interactions */ 34 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorAppEvents; 35 | 36 | /*! Log Informational occurrences */ 37 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorInformational; 38 | 39 | /*! Log cache errors. */ 40 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorCacheErrors; 41 | 42 | /*! Log errors from SDK UI controls */ 43 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorUIControlErrors; 44 | 45 | /*! Log debug warnings from API response, i.e. when friends fields requested, but user_friends permission isn't granted. */ 46 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorGraphAPIDebugWarning; 47 | 48 | /*! Log warnings from API response, i.e. when requested feature will be deprecated in next version of API. 49 | Info is the lowest level of severity, using it will result in logging all previously mentioned levels. 50 | */ 51 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorGraphAPIDebugInfo; 52 | 53 | /*! Log errors from SDK network requests */ 54 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorNetworkRequests; 55 | 56 | /*! Log errors likely to be preventable by the developer. This is in the default set of enabled logging behaviors. */ 57 | FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorDeveloperErrors; 58 | 59 | @interface FBSDKSettings : NSObject 60 | 61 | /*! 62 | @abstract Get the Facebook App ID used by the SDK. 63 | @discussion If not explicitly set, the default will be read from the application's plist (FacebookAppID). 64 | */ 65 | + (NSString *)appID; 66 | 67 | /*! 68 | @abstract Set the Facebook App ID to be used by the SDK. 69 | @param appID The Facebook App ID to be used by the SDK. 70 | */ 71 | + (void)setAppID:(NSString *)appID; 72 | 73 | /*! 74 | @abstract Get the default url scheme suffix used for sessions. 75 | @discussion If not explicitly set, the default will be read from the application's plist (FacebookUrlSchemeSuffix). 76 | */ 77 | + (NSString *)appURLSchemeSuffix; 78 | 79 | /*! 80 | @abstract Set the app url scheme suffix used by the SDK. 81 | @param appURLSchemeSuffix The url scheme suffix to be used by the SDK. 82 | */ 83 | + (void)setAppURLSchemeSuffix:(NSString *)appURLSchemeSuffix; 84 | 85 | /*! 86 | @abstract Retrieve the Client Token that has been set via [FBSDKSettings setClientToken]. 87 | @discussion If not explicitly set, the default will be read from the application's plist (FacebookClientToken). 88 | */ 89 | + (NSString *)clientToken; 90 | 91 | /*! 92 | @abstract Sets the Client Token for the Facebook App. 93 | @discussion This is needed for certain API calls when made anonymously, without a user-based access token. 94 | @param clientToken The Facebook App's "client token", which, for a given appid can be found in the Security 95 | section of the Advanced tab of the Facebook App settings found at 96 | */ 97 | + (void)setClientToken:(NSString *)clientToken; 98 | 99 | /*! 100 | @abstract A convenient way to toggle error recovery for all FBSDKGraphRequest instances created after this is set. 101 | @param disableGraphErrorRecovery YES or NO. 102 | */ 103 | + (void)setGraphErrorRecoveryDisabled:(BOOL)disableGraphErrorRecovery; 104 | 105 | /*! 106 | @abstract Get the Facebook Display Name used by the SDK. 107 | @discussion If not explicitly set, the default will be read from the application's plist (FacebookDisplayName). 108 | */ 109 | + (NSString *)displayName; 110 | 111 | /*! 112 | @abstract Set the default Facebook Display Name to be used by the SDK. 113 | @discussion This should match the Display Name that has been set for the app with the corresponding Facebook App ID, 114 | in the Facebook App Dashboard. 115 | @param displayName The Facebook Display Name to be used by the SDK. 116 | */ 117 | + (void)setDisplayName:(NSString *)displayName; 118 | 119 | /*! 120 | @abstract Get the Facebook domain part. 121 | @discussion If not explicitly set, the default will be read from the application's plist (FacebookDomainPart). 122 | */ 123 | + (NSString *)facebookDomainPart; 124 | 125 | /*! 126 | @abstract Set the subpart of the Facebook domain. 127 | @discussion This can be used to change the Facebook domain (e.g. @"beta") so that requests will be sent to 128 | graph.beta.facebook.com 129 | @param facebookDomainPart The domain part to be inserted into facebook.com. 130 | */ 131 | + (void)setFacebookDomainPart:(NSString *)facebookDomainPart; 132 | 133 | /*! 134 | @abstract The quality of JPEG images sent to Facebook from the SDK. 135 | @discussion If not explicitly set, the default is 0.9. 136 | @see [UIImageJPEGRepresentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/#//apple_ref/c/func/UIImageJPEGRepresentation) */ 137 | + (CGFloat)JPEGCompressionQuality; 138 | 139 | /*! 140 | @abstract Set the quality of JPEG images sent to Facebook from the SDK. 141 | @param JPEGCompressionQuality The quality for JPEG images, expressed as a value from 0.0 to 1.0. 142 | @see [UIImageJPEGRepresentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/#//apple_ref/c/func/UIImageJPEGRepresentation) */ 143 | + (void)setJPEGCompressionQuality:(CGFloat)JPEGCompressionQuality; 144 | 145 | /*! 146 | @abstract 147 | Gets whether data such as that generated through FBSDKAppEvents and sent to Facebook should be restricted from being used for other than analytics and conversions. Defaults to NO. This value is stored on the device and persists across app launches. 148 | */ 149 | + (BOOL)limitEventAndDataUsage; 150 | 151 | /*! 152 | @abstract 153 | Sets whether data such as that generated through FBSDKAppEvents and sent to Facebook should be restricted from being used for other than analytics and conversions. Defaults to NO. This value is stored on the device and persists across app launches. 154 | 155 | @param limitEventAndDataUsage The desired value. 156 | */ 157 | + (void)setLimitEventAndDataUsage:(BOOL)limitEventAndDataUsage; 158 | 159 | /*! 160 | @abstract Retrieve the current iOS SDK version. 161 | */ 162 | + (NSString *)sdkVersion; 163 | 164 | /*! 165 | @abstract Retrieve the current Facebook SDK logging behavior. 166 | */ 167 | + (NSSet *)loggingBehavior; 168 | 169 | /*! 170 | @abstract Set the current Facebook SDK logging behavior. This should consist of strings defined as 171 | constants with FBSDKLoggingBehavior*. 172 | 173 | @param loggingBehavior A set of strings indicating what information should be logged. If nil is provided, the logging 174 | behavior is reset to the default set of enabled behaviors. Set to an empty set in order to disable all logging. 175 | 176 | @discussion You can also define this via an array in your app plist with key "FacebookLoggingBehavior" or add and remove individual values via enableLoggingBehavior: or disableLogginBehavior: 177 | */ 178 | + (void)setLoggingBehavior:(NSSet *)loggingBehavior; 179 | 180 | /*! 181 | @abstract Enable a particular Facebook SDK logging behavior. 182 | 183 | @param loggingBehavior The LoggingBehavior to enable. This should be a string defined as a constant with FBSDKLoggingBehavior*. 184 | */ 185 | + (void)enableLoggingBehavior:(NSString *)loggingBehavior; 186 | 187 | /*! 188 | @abstract Disable a particular Facebook SDK logging behavior. 189 | 190 | @param loggingBehavior The LoggingBehavior to disable. This should be a string defined as a constant with FBSDKLoggingBehavior*. 191 | */ 192 | + (void)disableLoggingBehavior:(NSString *)loggingBehavior; 193 | 194 | /*! 195 | @abstract Set the user defaults key used by legacy token caches. 196 | 197 | @param tokenInformationKeyName the key used by legacy token caches. 198 | 199 | @discussion Use this only if you customized FBSessionTokenCachingStrategy in v3.x of 200 | the Facebook SDK for iOS. 201 | */ 202 | + (void)setLegacyUserDefaultTokenInformationKeyName:(NSString *)tokenInformationKeyName; 203 | 204 | /*! 205 | @abstract Get the user defaults key used by legacy token caches. 206 | */ 207 | + (NSString *)legacyUserDefaultTokenInformationKeyName; 208 | 209 | @end 210 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKGraphRequestConnection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import 22 | 23 | @class FBSDKGraphRequest; 24 | @class FBSDKGraphRequestConnection; 25 | 26 | /*! 27 | @typedef FBSDKGraphRequestHandler 28 | 29 | @abstract 30 | A block that is passed to addRequest to register for a callback with the results of that 31 | request once the connection completes. 32 | 33 | @discussion 34 | Pass a block of this type when calling addRequest. This will be called once 35 | the request completes. The call occurs on the UI thread. 36 | 37 | @param connection The `FBSDKGraphRequestConnection` that sent the request. 38 | 39 | @param result The result of the request. This is a translation of 40 | JSON data to `NSDictionary` and `NSArray` objects. This 41 | is nil if there was an error. 42 | 43 | @param error The `NSError` representing any error that occurred. 44 | 45 | */ 46 | typedef void (^FBSDKGraphRequestHandler)(FBSDKGraphRequestConnection *connection, 47 | id result, 48 | NSError *error); 49 | 50 | /*! 51 | @protocol 52 | 53 | @abstract 54 | The `FBSDKGraphRequestConnectionDelegate` protocol defines the methods used to receive network 55 | activity progress information from a . 56 | */ 57 | @protocol FBSDKGraphRequestConnectionDelegate 58 | 59 | @optional 60 | 61 | /*! 62 | @method 63 | 64 | @abstract 65 | Tells the delegate the request connection will begin loading 66 | 67 | @discussion 68 | If the is created using one of the convenience factory methods prefixed with 69 | start, the object returned from the convenience method has already begun loading and this method 70 | will not be called when the delegate is set. 71 | 72 | @param connection The request connection that is starting a network request 73 | */ 74 | - (void)requestConnectionWillBeginLoading:(FBSDKGraphRequestConnection *)connection; 75 | 76 | /*! 77 | @method 78 | 79 | @abstract 80 | Tells the delegate the request connection finished loading 81 | 82 | @discussion 83 | If the request connection completes without a network error occuring then this method is called. 84 | Invocation of this method does not indicate success of every made, only that the 85 | request connection has no further activity. Use the error argument passed to the FBSDKGraphRequestHandler 86 | block to determine success or failure of each . 87 | 88 | This method is invoked after the completion handler for each . 89 | 90 | @param connection The request connection that successfully completed a network request 91 | */ 92 | - (void)requestConnectionDidFinishLoading:(FBSDKGraphRequestConnection *)connection; 93 | 94 | /*! 95 | @method 96 | 97 | @abstract 98 | Tells the delegate the request connection failed with an error 99 | 100 | @discussion 101 | If the request connection fails with a network error then this method is called. The `error` 102 | argument specifies why the network connection failed. The `NSError` object passed to the 103 | FBSDKGraphRequestHandler block may contain additional information. 104 | 105 | @param connection The request connection that successfully completed a network request 106 | @param error The `NSError` representing the network error that occurred, if any. May be nil 107 | in some circumstances. Consult the `NSError` for the for reliable 108 | failure information. 109 | */ 110 | - (void)requestConnection:(FBSDKGraphRequestConnection *)connection 111 | didFailWithError:(NSError *)error; 112 | 113 | /*! 114 | @method 115 | 116 | @abstract 117 | Tells the delegate how much data has been sent and is planned to send to the remote host 118 | 119 | @discussion 120 | The byte count arguments refer to the aggregated objects, not a particular . 121 | 122 | Like `NSURLConnection`, the values may change in unexpected ways if data needs to be resent. 123 | 124 | @param connection The request connection transmitting data to a remote host 125 | @param bytesWritten The number of bytes sent in the last transmission 126 | @param totalBytesWritten The total number of bytes sent to the remote host 127 | @param totalBytesExpectedToWrite The total number of bytes expected to send to the remote host 128 | */ 129 | - (void)requestConnection:(FBSDKGraphRequestConnection *)connection 130 | didSendBodyData:(NSInteger)bytesWritten 131 | totalBytesWritten:(NSInteger)totalBytesWritten 132 | totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite; 133 | 134 | @end 135 | 136 | /*! 137 | @class FBSDKGraphRequestConnection 138 | 139 | @abstract 140 | The `FBSDKGraphRequestConnection` represents a single connection to Facebook to service a request. 141 | 142 | @discussion 143 | The request settings are encapsulated in a reusable object. The 144 | `FBSDKGraphRequestConnection` object encapsulates the concerns of a single communication 145 | e.g. starting a connection, canceling a connection, or batching requests. 146 | 147 | */ 148 | @interface FBSDKGraphRequestConnection : NSObject 149 | 150 | /*! 151 | @abstract 152 | The delegate object that receives updates. 153 | */ 154 | @property (nonatomic, assign) id delegate; 155 | 156 | /*! 157 | @abstract Gets or sets the timeout interval to wait for a response before giving up. 158 | */ 159 | @property (nonatomic) NSTimeInterval timeout; 160 | 161 | /*! 162 | @abstract 163 | The raw response that was returned from the server. (readonly) 164 | 165 | @discussion 166 | This property can be used to inspect HTTP headers that were returned from 167 | the server. 168 | 169 | The property is nil until the request completes. If there was a response 170 | then this property will be non-nil during the FBSDKGraphRequestHandler callback. 171 | */ 172 | @property (nonatomic, retain, readonly) NSHTTPURLResponse *URLResponse; 173 | 174 | /*! 175 | @methodgroup Adding requests 176 | */ 177 | 178 | /*! 179 | @method 180 | 181 | @abstract 182 | This method adds an object to this connection. 183 | 184 | @param request A request to be included in the round-trip when start is called. 185 | @param handler A handler to call back when the round-trip completes or times out. 186 | 187 | @discussion 188 | The completion handler is retained until the block is called upon the 189 | completion or cancellation of the connection. 190 | */ 191 | - (void)addRequest:(FBSDKGraphRequest *)request 192 | completionHandler:(FBSDKGraphRequestHandler)handler; 193 | 194 | /*! 195 | @method 196 | 197 | @abstract 198 | This method adds an object to this connection. 199 | 200 | @param request A request to be included in the round-trip when start is called. 201 | 202 | @param handler A handler to call back when the round-trip completes or times out. 203 | The handler will be invoked on the main thread. 204 | 205 | @param name An optional name for this request. This can be used to feed 206 | the results of one request to the input of another in the same 207 | `FBSDKGraphRequestConnection` as described in 208 | [Graph API Batch Requests]( https://developers.facebook.com/docs/reference/api/batch/ ). 209 | 210 | @discussion 211 | The completion handler is retained until the block is called upon the 212 | completion or cancellation of the connection. This request can be named 213 | to allow for using the request's response in a subsequent request. 214 | */ 215 | - (void)addRequest:(FBSDKGraphRequest *)request 216 | completionHandler:(FBSDKGraphRequestHandler)handler 217 | batchEntryName:(NSString *)name; 218 | 219 | /*! 220 | @method 221 | 222 | @abstract 223 | This method adds an object to this connection. 224 | 225 | @param request A request to be included in the round-trip when start is called. 226 | 227 | @param handler A handler to call back when the round-trip completes or times out. 228 | 229 | @param batchParameters The optional dictionary of parameters to include for this request 230 | as described in [Graph API Batch Requests]( https://developers.facebook.com/docs/reference/api/batch/ ). 231 | Examples include "depends_on", "name", or "omit_response_on_success". 232 | 233 | @discussion 234 | The completion handler is retained until the block is called upon the 235 | completion or cancellation of the connection. This request can be named 236 | to allow for using the request's response in a subsequent request. 237 | */ 238 | - (void)addRequest:(FBSDKGraphRequest *)request 239 | completionHandler:(FBSDKGraphRequestHandler)handler 240 | batchParameters:(NSDictionary *)batchParameters; 241 | 242 | /*! 243 | @methodgroup Instance methods 244 | */ 245 | 246 | /*! 247 | @method 248 | 249 | @abstract 250 | Signals that a connection should be logically terminated as the 251 | application is no longer interested in a response. 252 | 253 | @discussion 254 | Synchronously calls any handlers indicating the request was cancelled. Cancel 255 | does not guarantee that the request-related processing will cease. It 256 | does promise that all handlers will complete before the cancel returns. A call to 257 | cancel prior to a start implies a cancellation of all requests associated 258 | with the connection. 259 | */ 260 | - (void)cancel; 261 | 262 | /*! 263 | @method 264 | 265 | @abstract 266 | This method starts a connection with the server and is capable of handling all of the 267 | requests that were added to the connection. 268 | 269 | @discussion By default, a connection is scheduled on the current thread in the default mode when it is created. 270 | See `setDelegateQueue:` for other options. 271 | 272 | This method cannot be called twice for an `FBSDKGraphRequestConnection` instance. 273 | */ 274 | - (void)start; 275 | 276 | /*! 277 | @abstract Determines the operation queue that is used to call methods on the connection's delegate. 278 | @param queue The operation queue to use when calling delegate methods. 279 | @discussion By default, a connection is scheduled on the current thread in the default mode when it is created. 280 | You cannot reschedule a connection after it has started. 281 | 282 | This is very similar to `[NSURLConnection setDelegateQueue:]`. 283 | */ 284 | - (void)setDelegateQueue:(NSOperationQueue *)queue; 285 | 286 | /*! 287 | @method 288 | 289 | @abstract 290 | Overrides the default version for a batch request 291 | 292 | @discussion 293 | The SDK automatically prepends a version part, such as "v2.0" to API paths in order to simplify API versioning 294 | for applications. If you want to override the version part while using batch requests on the connection, call 295 | this method to set the version for the batch request. 296 | 297 | @param version This is a string in the form @"v2.0" which will be used for the version part of an API path 298 | */ 299 | - (void)overrideVersionPartWith:(NSString *)version; 300 | 301 | @end 302 | 303 | /*! 304 | @abstract The key in the result dictionary for requests to old versions of the Graph API 305 | whose response is not a JSON object. 306 | 307 | @discussion When a request returns a non-JSON response (such as a "true" literal), that response 308 | will be wrapped into a dictionary using this const as the key. This only applies for very few Graph API 309 | prior to v2.1. 310 | */ 311 | FBSDK_EXTERN NSString *const FBSDKNonJSONResponseProperty; 312 | -------------------------------------------------------------------------------- /Frameworks/FBSDKCoreKit.framework/Headers/FBSDKAppEvents.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. 2 | // 3 | // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4 | // copy, modify, and distribute this software in source code or binary form for use 5 | // in connection with the web services and APIs provided by Facebook. 6 | // 7 | // As with any software that integrates with the Facebook platform, your use of 8 | // this software is subject to the Facebook Developer Principles and Policies 9 | // [http://developers.facebook.com/policy/]. This copyright notice shall be 10 | // included in all copies or substantial portions of the software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | #import 20 | 21 | #import "FBSDKMacros.h" 22 | 23 | @class FBSDKAccessToken; 24 | @class FBSDKGraphRequest; 25 | 26 | /*! @abstract NSNotificationCenter name indicating a result of a failed log flush attempt. The posted object will be an NSError instance. */ 27 | FBSDK_EXTERN NSString *const FBSDKAppEventsLoggingResultNotification; 28 | 29 | /*! @abstract optional plist key ("FacebookLoggingOverrideAppID") for setting `loggingOverrideAppID` */ 30 | FBSDK_EXTERN NSString *const FBSDKAppEventsOverrideAppIDBundleKey; 31 | 32 | /*! 33 | 34 | @typedef NS_ENUM (NSUInteger, FBSDKAppEventsFlushBehavior) 35 | 36 | @abstract Specifies when `FBSDKAppEvents` sends log events to the server. 37 | 38 | */ 39 | typedef NS_ENUM(NSUInteger, FBSDKAppEventsFlushBehavior) 40 | { 41 | 42 | /*! Flush automatically: periodically (once a minute or every 100 logged events) and always at app reactivation. */ 43 | FBSDKAppEventsFlushBehaviorAuto = 0, 44 | 45 | /*! Only flush when the `flush` method is called. When an app is moved to background/terminated, the 46 | events are persisted and re-established at activation, but they will only be written with an 47 | explicit call to `flush`. */ 48 | FBSDKAppEventsFlushBehaviorExplicitOnly, 49 | 50 | }; 51 | 52 | /*! 53 | @methodgroup Predefined event names for logging events common to many apps. Logging occurs through the `logEvent` family of methods on `FBSDKAppEvents`. 54 | Common event parameters are provided in the `FBSDKAppEventsParameterNames*` constants. 55 | */ 56 | 57 | /*! Log this event when the user has achieved a level in the app. */ 58 | FBSDK_EXTERN NSString *const FBSDKAppEventNameAchievedLevel; 59 | 60 | /*! Log this event when the user has entered their payment info. */ 61 | FBSDK_EXTERN NSString *const FBSDKAppEventNameAddedPaymentInfo; 62 | 63 | /*! Log this event when the user has added an item to their cart. The valueToSum passed to logEvent should be the item's price. */ 64 | FBSDK_EXTERN NSString *const FBSDKAppEventNameAddedToCart; 65 | 66 | /*! Log this event when the user has added an item to their wishlist. The valueToSum passed to logEvent should be the item's price. */ 67 | FBSDK_EXTERN NSString *const FBSDKAppEventNameAddedToWishlist; 68 | 69 | /*! Log this event when a user has completed registration with the app. */ 70 | FBSDK_EXTERN NSString *const FBSDKAppEventNameCompletedRegistration; 71 | 72 | /*! Log this event when the user has completed a tutorial in the app. */ 73 | FBSDK_EXTERN NSString *const FBSDKAppEventNameCompletedTutorial; 74 | 75 | /*! Log this event when the user has entered the checkout process. The valueToSum passed to logEvent should be the total price in the cart. */ 76 | FBSDK_EXTERN NSString *const FBSDKAppEventNameInitiatedCheckout; 77 | 78 | /*! Log this event when the user has rated an item in the app. The valueToSum passed to logEvent should be the numeric rating. */ 79 | FBSDK_EXTERN NSString *const FBSDKAppEventNameRated; 80 | 81 | /*! Log this event when a user has performed a search within the app. */ 82 | FBSDK_EXTERN NSString *const FBSDKAppEventNameSearched; 83 | 84 | /*! Log this event when the user has spent app credits. The valueToSum passed to logEvent should be the number of credits spent. */ 85 | FBSDK_EXTERN NSString *const FBSDKAppEventNameSpentCredits; 86 | 87 | /*! Log this event when the user has unlocked an achievement in the app. */ 88 | FBSDK_EXTERN NSString *const FBSDKAppEventNameUnlockedAchievement; 89 | 90 | /*! Log this event when a user has viewed a form of content in the app. */ 91 | FBSDK_EXTERN NSString *const FBSDKAppEventNameViewedContent; 92 | 93 | /*! 94 | @methodgroup Predefined event name parameters for common additional information to accompany events logged through the `logEvent` family 95 | of methods on `FBSDKAppEvents`. Common event names are provided in the `FBAppEventName*` constants. 96 | */ 97 | 98 | /*! Parameter key used to specify an ID for the specific piece of content being logged about. Could be an EAN, article identifier, etc., depending on the nature of the app. */ 99 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContentID; 100 | 101 | /*! Parameter key used to specify a generic content type/family for the logged event, e.g. "music", "photo", "video". Options to use will vary based upon what the app is all about. */ 102 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContentType; 103 | 104 | /*! Parameter key used to specify currency used with logged event. E.g. "USD", "EUR", "GBP". See ISO-4217 for specific values. One reference for these is . */ 105 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameCurrency; 106 | 107 | /*! Parameter key used to specify a description appropriate to the event being logged. E.g., the name of the achievement unlocked in the `FBAppEventNameAchievementUnlocked` event. */ 108 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameDescription; 109 | 110 | /*! Parameter key used to specify the level achieved in a `FBAppEventNameAchieved` event. */ 111 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameLevel; 112 | 113 | /*! Parameter key used to specify the maximum rating available for the `FBAppEventNameRate` event. E.g., "5" or "10". */ 114 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameMaxRatingValue; 115 | 116 | /*! Parameter key used to specify how many items are being processed for an `FBAppEventNameInitiatedCheckout` or `FBAppEventNamePurchased` event. */ 117 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameNumItems; 118 | 119 | /*! Parameter key used to specify whether payment info is available for the `FBAppEventNameInitiatedCheckout` event. `FBSDKAppEventParameterValueYes` and `FBSDKAppEventParameterValueNo` are good canonical values to use for this parameter. */ 120 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNamePaymentInfoAvailable; 121 | 122 | /*! Parameter key used to specify method user has used to register for the app, e.g., "Facebook", "email", "Twitter", etc */ 123 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameRegistrationMethod; 124 | 125 | /*! Parameter key used to specify the string provided by the user for a search operation. */ 126 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameSearchString; 127 | 128 | /*! Parameter key used to specify whether the activity being logged about was successful or not. `FBSDKAppEventParameterValueYes` and `FBSDKAppEventParameterValueNo` are good canonical values to use for this parameter. */ 129 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameSuccess; 130 | 131 | /* 132 | @methodgroup Predefined values to assign to event parameters that accompany events logged through the `logEvent` family 133 | of methods on `FBSDKAppEvents`. Common event parameters are provided in the `FBSDKAppEventParameterName*` constants. 134 | */ 135 | 136 | /*! Yes-valued parameter value to be used with parameter keys that need a Yes/No value */ 137 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterValueYes; 138 | 139 | /*! No-valued parameter value to be used with parameter keys that need a Yes/No value */ 140 | FBSDK_EXTERN NSString *const FBSDKAppEventParameterValueNo; 141 | 142 | 143 | /*! 144 | 145 | @class FBSDKAppEvents 146 | 147 | @abstract 148 | Client-side event logging for specialized application analytics available through Facebook App Insights 149 | and for use with Facebook Ads conversion tracking and optimization. 150 | 151 | @discussion 152 | The `FBSDKAppEvents` static class has a few related roles: 153 | 154 | + Logging predefined and application-defined events to Facebook App Insights with a 155 | numeric value to sum across a large number of events, and an optional set of key/value 156 | parameters that define "segments" for this event (e.g., 'purchaserStatus' : 'frequent', or 157 | 'gamerLevel' : 'intermediate') 158 | 159 | + Logging events to later be used for ads optimization around lifetime value. 160 | 161 | + Methods that control the way in which events are flushed out to the Facebook servers. 162 | 163 | Here are some important characteristics of the logging mechanism provided by `FBSDKAppEvents`: 164 | 165 | + Events are not sent immediately when logged. They're cached and flushed out to the Facebook servers 166 | in a number of situations: 167 | - when an event count threshold is passed (currently 100 logged events). 168 | - when a time threshold is passed (currently 15 seconds). 169 | - when an app has gone to background and is then brought back to the foreground. 170 | 171 | + Events will be accumulated when the app is in a disconnected state, and sent when the connection is 172 | restored and one of the above 'flush' conditions are met. 173 | 174 | + The `FBSDKAppEvents` class in thread-safe in that events may be logged from any of the app's threads. 175 | 176 | + The developer can set the `flushBehavior` on `FBSDKAppEvents` to force the flushing of events to only 177 | occur on an explicit call to the `flush` method. 178 | 179 | + The developer can turn on console debug output for event logging and flushing to the server by using 180 | the `FBSDKLoggingBehaviorAppEvents` value in `[FBSettings setLoggingBehavior:]`. 181 | 182 | Some things to note when logging events: 183 | 184 | + There is a limit on the number of unique event names an app can use, on the order of 300. 185 | + There is a limit to the number of unique parameter names in the provided parameters that can 186 | be used per event, on the order of 25. This is not just for an individual call, but for all 187 | invocations for that eventName. 188 | + Event names and parameter names (the keys in the NSDictionary) must be between 2 and 40 characters, and 189 | must consist of alphanumeric characters, _, -, or spaces. 190 | + The length of each parameter value can be no more than on the order of 100 characters. 191 | 192 | */ 193 | @interface FBSDKAppEvents : NSObject 194 | 195 | /* 196 | * Basic event logging 197 | */ 198 | 199 | /*! 200 | 201 | @abstract 202 | Log an event with just an eventName. 203 | 204 | @param eventName The name of the event to record. Limitations on number of events and name length 205 | are given in the `FBSDKAppEvents` documentation. 206 | 207 | */ 208 | + (void)logEvent:(NSString *)eventName; 209 | 210 | /*! 211 | 212 | @abstract 213 | Log an event with an eventName and a numeric value to be aggregated with other events of this name. 214 | 215 | @param eventName The name of the event to record. Limitations on number of events and name length 216 | are given in the `FBSDKAppEvents` documentation. Common event names are provided in `FBAppEventName*` constants. 217 | 218 | @param valueToSum Amount to be aggregated into all events of this eventName, and App Insights will report 219 | the cumulative and average value of this amount. 220 | */ 221 | + (void)logEvent:(NSString *)eventName 222 | valueToSum:(double)valueToSum; 223 | 224 | 225 | /*! 226 | 227 | @abstract 228 | Log an event with an eventName and a set of key/value pairs in the parameters dictionary. 229 | Parameter limitations are described above. 230 | 231 | @param eventName The name of the event to record. Limitations on number of events and name construction 232 | are given in the `FBSDKAppEvents` documentation. Common event names are provided in `FBAppEventName*` constants. 233 | 234 | @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must 235 | be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of 236 | parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names 237 | are provided in `FBSDKAppEventParameterName*` constants. 238 | */ 239 | + (void)logEvent:(NSString *)eventName 240 | parameters:(NSDictionary *)parameters; 241 | 242 | /*! 243 | 244 | @abstract 245 | Log an event with an eventName, a numeric value to be aggregated with other events of this name, 246 | and a set of key/value pairs in the parameters dictionary. 247 | 248 | @param eventName The name of the event to record. Limitations on number of events and name construction 249 | are given in the `FBSDKAppEvents` documentation. Common event names are provided in `FBAppEventName*` constants. 250 | 251 | @param valueToSum Amount to be aggregated into all events of this eventName, and App Insights will report 252 | the cumulative and average value of this amount. 253 | 254 | @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must 255 | be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of 256 | parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names 257 | are provided in `FBSDKAppEventParameterName*` constants. 258 | 259 | */ 260 | + (void)logEvent:(NSString *)eventName 261 | valueToSum:(double)valueToSum 262 | parameters:(NSDictionary *)parameters; 263 | 264 | 265 | /*! 266 | 267 | @abstract 268 | Log an event with an eventName, a numeric value to be aggregated with other events of this name, 269 | and a set of key/value pairs in the parameters dictionary. Providing session lets the developer 270 | target a particular . If nil is provided, then `[FBSession activeSession]` will be used. 271 | 272 | @param eventName The name of the event to record. Limitations on number of events and name construction 273 | are given in the `FBSDKAppEvents` documentation. Common event names are provided in `FBAppEventName*` constants. 274 | 275 | @param valueToSum Amount to be aggregated into all events of this eventName, and App Insights will report 276 | the cumulative and average value of this amount. Note that this is an NSNumber, and a value of `nil` denotes 277 | that this event doesn't have a value associated with it for summation. 278 | 279 | @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must 280 | be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of 281 | parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names 282 | are provided in `FBSDKAppEventParameterName*` constants. 283 | 284 | @param accessToken The optional access token to log the event as. 285 | */ 286 | + (void)logEvent:(NSString *)eventName 287 | valueToSum:(NSNumber *)valueToSum 288 | parameters:(NSDictionary *)parameters 289 | accessToken:(FBSDKAccessToken *)accessToken; 290 | 291 | /* 292 | * Purchase logging 293 | */ 294 | 295 | /*! 296 | 297 | @abstract 298 | Log a purchase of the specified amount, in the specified currency. 299 | 300 | @param purchaseAmount Purchase amount to be logged, as expressed in the specified currency. This value 301 | will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346). 302 | 303 | @param currency Currency, is denoted as, e.g. "USD", "EUR", "GBP". See ISO-4217 for 304 | specific values. One reference for these is . 305 | 306 | @discussion This event immediately triggers a flush of the `FBSDKAppEvents` event queue, unless the `flushBehavior` is set 307 | to `FBSDKAppEventsFlushBehaviorExplicitOnly`. 308 | 309 | */ 310 | + (void)logPurchase:(double)purchaseAmount 311 | currency:(NSString *)currency; 312 | 313 | /*! 314 | 315 | @abstract 316 | Log a purchase of the specified amount, in the specified currency, also providing a set of 317 | additional characteristics describing the purchase. 318 | 319 | @param purchaseAmount Purchase amount to be logged, as expressed in the specified currency.This value 320 | will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346). 321 | 322 | @param currency Currency, is denoted as, e.g. "USD", "EUR", "GBP". See ISO-4217 for 323 | specific values. One reference for these is . 324 | 325 | @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must 326 | be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of 327 | parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names 328 | are provided in `FBSDKAppEventParameterName*` constants. 329 | 330 | @discussion This event immediately triggers a flush of the `FBSDKAppEvents` event queue, unless the `flushBehavior` is set 331 | to `FBSDKAppEventsFlushBehaviorExplicitOnly`. 332 | 333 | */ 334 | + (void)logPurchase:(double)purchaseAmount 335 | currency:(NSString *)currency 336 | parameters:(NSDictionary *)parameters; 337 | 338 | /*! 339 | 340 | @abstract 341 | Log a purchase of the specified amount, in the specified currency, also providing a set of 342 | additional characteristics describing the purchase, as well as an to log to. 343 | 344 | @param purchaseAmount Purchase amount to be logged, as expressed in the specified currency.This value 345 | will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346). 346 | 347 | @param currency Currency, is denoted as, e.g. "USD", "EUR", "GBP". See ISO-4217 for 348 | specific values. One reference for these is . 349 | 350 | @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must 351 | be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of 352 | parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names 353 | are provided in `FBSDKAppEventParameterName*` constants. 354 | 355 | @param accessToken The optional access token to log the event as. 356 | 357 | @discussion This event immediately triggers a flush of the `FBSDKAppEvents` event queue, unless the `flushBehavior` is set 358 | to `FBSDKAppEventsFlushBehaviorExplicitOnly`. 359 | 360 | */ 361 | + (void)logPurchase:(double)purchaseAmount 362 | currency:(NSString *)currency 363 | parameters:(NSDictionary *)parameters 364 | accessToken:(FBSDKAccessToken *)accessToken; 365 | 366 | /*! 367 | 368 | @abstract 369 | Notifies the events system that the app has launched and, when appropriate, logs an "activated app" event. Should typically be placed in the 370 | app delegates' `applicationDidBecomeActive:` method. 371 | 372 | This method also takes care of logging the event indicating the first time this app has been launched, which, among other things, is used to 373 | track user acquisition and app install ads conversions. 374 | 375 | @discussion 376 | `activateApp` will not log an event on every app launch, since launches happen every time the app is backgrounded and then foregrounded. 377 | "activated app" events will be logged when the app has not been active for more than 60 seconds. This method also causes a "deactivated app" 378 | event to be logged when sessions are "completed", and these events are logged with the session length, with an indication of how much 379 | time has elapsed between sessions, and with the number of background/foreground interruptions that session had. This data 380 | is all visible in your app's App Events Insights. 381 | */ 382 | + (void)activateApp; 383 | 384 | /* 385 | * Control over event batching/flushing 386 | */ 387 | 388 | /*! 389 | 390 | @abstract 391 | Get the current event flushing behavior specifying when events are sent back to Facebook servers. 392 | */ 393 | + (FBSDKAppEventsFlushBehavior)flushBehavior; 394 | 395 | /*! 396 | 397 | @abstract 398 | Set the current event flushing behavior specifying when events are sent back to Facebook servers. 399 | 400 | @param flushBehavior The desired `FBSDKAppEventsFlushBehavior` to be used. 401 | */ 402 | + (void)setFlushBehavior:(FBSDKAppEventsFlushBehavior)flushBehavior; 403 | 404 | /*! 405 | @abstract 406 | Set the 'override' App ID for App Event logging. 407 | 408 | @discussion 409 | In some cases, apps want to use one Facebook App ID for login and social presence and another 410 | for App Event logging. (An example is if multiple apps from the same company share an app ID for login, but 411 | want distinct logging.) By default, this value is `nil`, and defers to the `FBSDKAppEventsOverrideAppIDBundleKey` 412 | plist value. If that's not set, it defaults to `[FBSDKSettigns appID]`. 413 | 414 | This should be set before any other calls are made to `FBSDKAppEvents`. Thus, you should set it in your application 415 | delegate's `application:didFinishLaunchingWithOptions:` delegate. 416 | 417 | @param appID The Facebook App ID to be used for App Event logging. 418 | */ 419 | + (void)setLoggingOverrideAppID:(NSString *)appID; 420 | 421 | /*! 422 | @abstract 423 | Get the 'override' App ID for App Event logging. 424 | 425 | @see setLoggingOverrideAppID: 426 | 427 | */ 428 | + (NSString *)loggingOverrideAppID; 429 | 430 | 431 | /*! 432 | @abstract 433 | Explicitly kick off flushing of events to Facebook. This is an asynchronous method, but it does initiate an immediate 434 | kick off. Server failures will be reported through the NotificationCenter with notification ID `FBSDKAppEventsLoggingResultNotification`. 435 | */ 436 | + (void)flush; 437 | 438 | /*! 439 | @abstract 440 | Creates a request representing the Graph API call to retrieve a Custom Audience "third party ID" for the app's Facebook user. 441 | Callers will send this ID back to their own servers, collect up a set to create a Facebook Custom Audience with, 442 | and then use the resultant Custom Audience to target ads. 443 | 444 | @param accessToken The access token to use to establish the user's identity for users logged into Facebook through this app. 445 | If `nil`, then the `[FBSDKAccessToken currentAccessToken]` is used. 446 | 447 | @discussion 448 | The JSON in the request's response will include an "custom_audience_third_party_id" key/value pair, with the value being the ID retrieved. 449 | This ID is an encrypted encoding of the Facebook user's ID and the invoking Facebook app ID. 450 | Multiple calls with the same user will return different IDs, thus these IDs cannot be used to correlate behavior 451 | across devices or applications, and are only meaningful when sent back to Facebook for creating Custom Audiences. 452 | 453 | The ID retrieved represents the Facebook user identified in the following way: if the specified access token is valid, 454 | the ID will represent the user associated with that token; otherwise the ID will represent the user logged into the 455 | native Facebook app on the device. If there is no native Facebook app, no one is logged into it, or the user has opted out 456 | at the iOS level from ad tracking, then a `nil` ID will be returned. 457 | 458 | This method returns `nil` if either the user has opted-out (via iOS) from Ad Tracking, the app itself has limited event usage 459 | via the `[FBSDKSettings limitEventAndDataUsage]` flag, or a specific Facebook user cannot be identified. 460 | */ 461 | + (FBSDKGraphRequest *)requestForCustomAudienceThirdPartyIDWithAccessToken:(FBSDKAccessToken *)accessToken; 462 | @end 463 | --------------------------------------------------------------------------------