| @@ -0,0 +1,261 @@ | ||
| /* | ||
| * Copyright (c) 2014, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. An additional grant | ||
| * of patent rights can be found in the PATENTS file in the same directory. | ||
| * | ||
| */ | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #import <Bolts/BFCancellationToken.h> | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| /*! | ||
| Error domain used if there was multiple errors on <BFTask taskForCompletionOfAllTasks:>. | ||
| */ | ||
| extern NSString *const BFTaskErrorDomain; | ||
|
|
||
| /*! | ||
| An error code used for <BFTask taskForCompletionOfAllTasks:>, if there were multiple errors. | ||
| */ | ||
| extern NSInteger const kBFMultipleErrorsError; | ||
|
|
||
| /*! | ||
| An exception that is thrown if there was multiple exceptions on <BFTask taskForCompletionOfAllTasks:>. | ||
| */ | ||
| extern NSString *const BFTaskMultipleExceptionsException; | ||
|
|
||
| @class BFExecutor; | ||
| @class BFTask; | ||
|
|
||
| /*! | ||
| The consumer view of a Task. A BFTask has methods to | ||
| inspect the state of the task, and to add continuations to | ||
| be run once the task is complete. | ||
| */ | ||
| @interface BFTask<__covariant ResultType> : NSObject | ||
|
|
||
| /*! | ||
| A block that can act as a continuation for a task. | ||
| */ | ||
| typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *task); | ||
|
|
||
| /*! | ||
| Creates a task that is already completed with the given result. | ||
| @param result The result for the task. | ||
| */ | ||
| + (instancetype)taskWithResult:(nullable ResultType)result; | ||
|
|
||
| /*! | ||
| Creates a task that is already completed with the given error. | ||
| @param error The error for the task. | ||
| */ | ||
| + (instancetype)taskWithError:(NSError *)error; | ||
|
|
||
| /*! | ||
| Creates a task that is already completed with the given exception. | ||
| @param exception The exception for the task. | ||
| */ | ||
| + (instancetype)taskWithException:(NSException *)exception; | ||
|
|
||
| /*! | ||
| Creates a task that is already cancelled. | ||
| */ | ||
| + (instancetype)cancelledTask; | ||
|
|
||
| /*! | ||
| Returns a task that will be completed (with result == nil) once | ||
| all of the input tasks have completed. | ||
| @param tasks An `NSArray` of the tasks to use as an input. | ||
| */ | ||
| + (instancetype)taskForCompletionOfAllTasks:(nullable NSArray<BFTask *> *)tasks; | ||
|
|
||
| /*! | ||
| Returns a task that will be completed once all of the input tasks have completed. | ||
| If all tasks complete successfully without being faulted or cancelled the result will be | ||
| an `NSArray` of all task results in the order they were provided. | ||
| @param tasks An `NSArray` of the tasks to use as an input. | ||
| */ | ||
| + (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray<BFTask *> *)tasks; | ||
|
|
||
| /*! | ||
| Returns a task that will be completed a certain amount of time in the future. | ||
| @param millis The approximate number of milliseconds to wait before the | ||
| task will be finished (with result == nil). | ||
| */ | ||
| + (instancetype)taskWithDelay:(int)millis; | ||
|
|
||
| /*! | ||
| Returns a task that will be completed a certain amount of time in the future. | ||
| @param millis The approximate number of milliseconds to wait before the | ||
| task will be finished (with result == nil). | ||
| @param token The cancellation token (optional). | ||
| */ | ||
| + (instancetype)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token; | ||
|
|
||
| /*! | ||
| Returns a task that will be completed after the given block completes with | ||
| the specified executor. | ||
| @param executor A BFExecutor responsible for determining how the | ||
| continuation block will be run. | ||
| @param block The block to immediately schedule to run with the given executor. | ||
| @returns A task that will be completed after block has run. | ||
| If block returns a BFTask, then the task returned from | ||
| this method will not be completed until that task is completed. | ||
| */ | ||
| + (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(nullable id (^)())block; | ||
|
|
||
| // Properties that will be set on the task once it is completed. | ||
|
|
||
| /*! | ||
| The result of a successful task. | ||
| */ | ||
| @property (nullable, nonatomic, strong, readonly) ResultType result; | ||
|
|
||
| /*! | ||
| The error of a failed task. | ||
| */ | ||
| @property (nullable, nonatomic, strong, readonly) NSError *error; | ||
|
|
||
| /*! | ||
| The exception of a failed task. | ||
| */ | ||
| @property (nullable, nonatomic, strong, readonly) NSException *exception; | ||
|
|
||
| /*! | ||
| Whether this task has been cancelled. | ||
| */ | ||
| @property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled; | ||
|
|
||
| /*! | ||
| Whether this task has completed due to an error or exception. | ||
| */ | ||
| @property (nonatomic, assign, readonly, getter=isFaulted) BOOL faulted; | ||
|
|
||
| /*! | ||
| Whether this task has completed. | ||
| */ | ||
| @property (nonatomic, assign, readonly, getter=isCompleted) BOOL completed; | ||
|
|
||
| /*! | ||
| Enqueues the given block to be run once this task is complete. | ||
| This method uses a default execution strategy. The block will be | ||
| run on the thread where the previous task completes, unless the | ||
| the stack depth is too deep, in which case it will be run on a | ||
| dispatch queue with default priority. | ||
| @param block The block to be run once this task is complete. | ||
| @returns A task that will be completed after block has run. | ||
| If block returns a BFTask, then the task returned from | ||
| this method will not be completed until that task is completed. | ||
| */ | ||
| - (BFTask *)continueWithBlock:(BFContinuationBlock)block; | ||
|
|
||
| /*! | ||
| Enqueues the given block to be run once this task is complete. | ||
| This method uses a default execution strategy. The block will be | ||
| run on the thread where the previous task completes, unless the | ||
| the stack depth is too deep, in which case it will be run on a | ||
| dispatch queue with default priority. | ||
| @param block The block to be run once this task is complete. | ||
| @param cancellationToken The cancellation token (optional). | ||
| @returns A task that will be completed after block has run. | ||
| If block returns a BFTask, then the task returned from | ||
| this method will not be completed until that task is completed. | ||
| */ | ||
| - (BFTask *)continueWithBlock:(BFContinuationBlock)block cancellationToken:(nullable BFCancellationToken *)cancellationToken; | ||
|
|
||
| /*! | ||
| Enqueues the given block to be run once this task is complete. | ||
| @param executor A BFExecutor responsible for determining how the | ||
| continuation block will be run. | ||
| @param block The block to be run once this task is complete. | ||
| @returns A task that will be completed after block has run. | ||
| If block returns a BFTask, then the task returned from | ||
| this method will not be completed until that task is completed. | ||
| */ | ||
| - (BFTask *)continueWithExecutor:(BFExecutor *)executor withBlock:(BFContinuationBlock)block; | ||
| /*! | ||
| Enqueues the given block to be run once this task is complete. | ||
| @param executor A BFExecutor responsible for determining how the | ||
| continuation block will be run. | ||
| @param block The block to be run once this task is complete. | ||
| @param cancellationToken The cancellation token (optional). | ||
| @returns A task that will be completed after block has run. | ||
| If block returns a BFTask, then the task returned from | ||
| his method will not be completed until that task is completed. | ||
| */ | ||
| - (BFTask *)continueWithExecutor:(BFExecutor *)executor | ||
| block:(BFContinuationBlock)block | ||
| cancellationToken:(nullable BFCancellationToken *)cancellationToken; | ||
|
|
||
| /*! | ||
| Identical to continueWithBlock:, except that the block is only run | ||
| if this task did not produce a cancellation, error, or exception. | ||
| If it did, then the failure will be propagated to the returned | ||
| task. | ||
| @param block The block to be run once this task is complete. | ||
| @returns A task that will be completed after block has run. | ||
| If block returns a BFTask, then the task returned from | ||
| this method will not be completed until that task is completed. | ||
| */ | ||
| - (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block; | ||
|
|
||
| /*! | ||
| Identical to continueWithBlock:, except that the block is only run | ||
| if this task did not produce a cancellation, error, or exception. | ||
| If it did, then the failure will be propagated to the returned | ||
| task. | ||
| @param block The block to be run once this task is complete. | ||
| @param cancellationToken The cancellation token (optional). | ||
| @returns A task that will be completed after block has run. | ||
| If block returns a BFTask, then the task returned from | ||
| this method will not be completed until that task is completed. | ||
| */ | ||
| - (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block cancellationToken:(nullable BFCancellationToken *)cancellationToken; | ||
|
|
||
| /*! | ||
| Identical to continueWithExecutor:withBlock:, except that the block | ||
| is only run if this task did not produce a cancellation, error, or | ||
| exception. If it did, then the failure will be propagated to the | ||
| returned task. | ||
| @param executor A BFExecutor responsible for determining how the | ||
| continuation block will be run. | ||
| @param block The block to be run once this task is complete. | ||
| @returns A task that will be completed after block has run. | ||
| If block returns a BFTask, then the task returned from | ||
| this method will not be completed until that task is completed. | ||
| */ | ||
| - (BFTask *)continueWithExecutor:(BFExecutor *)executor withSuccessBlock:(BFContinuationBlock)block; | ||
|
|
||
| /*! | ||
| Identical to continueWithExecutor:withBlock:, except that the block | ||
| is only run if this task did not produce a cancellation, error, or | ||
| exception. If it did, then the failure will be propagated to the | ||
| returned task. | ||
| @param executor A BFExecutor responsible for determining how the | ||
| continuation block will be run. | ||
| @param block The block to be run once this task is complete. | ||
| @param cancellationToken The cancellation token (optional). | ||
| @returns A task that will be completed after block has run. | ||
| If block returns a BFTask, then the task returned from | ||
| this method will not be completed until that task is completed. | ||
| */ | ||
| - (BFTask *)continueWithExecutor:(BFExecutor *)executor | ||
| successBlock:(BFContinuationBlock)block | ||
| cancellationToken:(nullable BFCancellationToken *)cancellationToken; | ||
|
|
||
| /*! | ||
| Waits until this operation is completed. | ||
| This method is inefficient and consumes a thread resource while | ||
| it's running. It should be avoided. This method logs a warning | ||
| message if it is used on the main thread. | ||
| */ | ||
| - (void)waitUntilFinished; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END |
| @@ -0,0 +1,89 @@ | ||
| /* | ||
| * Copyright (c) 2014, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. An additional grant | ||
| * of patent rights can be found in the PATENTS file in the same directory. | ||
| * | ||
| */ | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @class BFTask<ResultType>; | ||
|
|
||
| /*! | ||
| A BFTaskCompletionSource represents the producer side of tasks. | ||
| It is a task that also has methods for changing the state of the | ||
| task by settings its completion values. | ||
| */ | ||
| @interface BFTaskCompletionSource<__covariant ResultType> : NSObject | ||
|
|
||
| /*! | ||
| Creates a new unfinished task. | ||
| */ | ||
| + (instancetype)taskCompletionSource; | ||
|
|
||
| /*! | ||
| The task associated with this TaskCompletionSource. | ||
| */ | ||
| @property (nonatomic, strong, readonly) BFTask<ResultType> *task; | ||
|
|
||
| /*! | ||
| Completes the task by setting the result. | ||
| Attempting to set this for a completed task will raise an exception. | ||
| @param result The result of the task. | ||
| */ | ||
| - (void)setResult:(nullable ResultType)result; | ||
|
|
||
| /*! | ||
| Completes the task by setting the error. | ||
| Attempting to set this for a completed task will raise an exception. | ||
| @param error The error for the task. | ||
| */ | ||
| - (void)setError:(NSError *)error; | ||
|
|
||
| /*! | ||
| Completes the task by setting an exception. | ||
| Attempting to set this for a completed task will raise an exception. | ||
| @param exception The exception for the task. | ||
| */ | ||
| - (void)setException:(NSException *)exception; | ||
|
|
||
| /*! | ||
| Completes the task by marking it as cancelled. | ||
| Attempting to set this for a completed task will raise an exception. | ||
| */ | ||
| - (void)cancel; | ||
|
|
||
| /*! | ||
| Sets the result of the task if it wasn't already completed. | ||
| @returns whether the new value was set. | ||
| */ | ||
| - (BOOL)trySetResult:(nullable ResultType)result; | ||
|
|
||
| /*! | ||
| Sets the error of the task if it wasn't already completed. | ||
| @param error The error for the task. | ||
| @returns whether the new value was set. | ||
| */ | ||
| - (BOOL)trySetError:(NSError *)error; | ||
|
|
||
| /*! | ||
| Sets the exception of the task if it wasn't already completed. | ||
| @param exception The exception for the task. | ||
| @returns whether the new value was set. | ||
| */ | ||
| - (BOOL)trySetException:(NSException *)exception; | ||
|
|
||
| /*! | ||
| Sets the cancellation state of the task if it wasn't already completed. | ||
| @returns whether the new value was set. | ||
| */ | ||
| - (BOOL)trySetCancelled; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END |
| @@ -0,0 +1,75 @@ | ||
| /* | ||
| * Copyright (c) 2014, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. An additional grant | ||
| * of patent rights can be found in the PATENTS file in the same directory. | ||
| * | ||
| */ | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| @class BFAppLink; | ||
|
|
||
| /*! | ||
| Provides a set of utilities for working with NSURLs, such as parsing of query parameters | ||
| and handling for App Link requests. | ||
| */ | ||
| @interface BFURL : NSObject | ||
|
|
||
| /*! | ||
| Creates a link target from a raw URL. | ||
| On success, this posts the BFAppLinkParseEventName measurement event. If you are constructing the BFURL within your application delegate's | ||
| application:openURL:sourceApplication:annotation:, you should instead use URLWithInboundURL:sourceApplication: | ||
| to support better BFMeasurementEvent notifications | ||
| @param url The instance of `NSURL` to create BFURL from. | ||
| */ | ||
| + (BFURL *)URLWithURL:(NSURL *)url; | ||
|
|
||
| /*! | ||
| Creates a link target from a raw URL received from an external application. This is typically called from the app delegate's | ||
| application:openURL:sourceApplication:annotation: and will post the BFAppLinkNavigateInEventName measurement event. | ||
| @param url The instance of `NSURL` to create BFURL from. | ||
| @param sourceApplication the bundle ID of the app that is requesting your app to open the URL. The same sourceApplication in application:openURL:sourceApplication:annotation: | ||
| */ | ||
| + (BFURL *)URLWithInboundURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication; | ||
|
|
||
| /*! | ||
| Gets the target URL. If the link is an App Link, this is the target of the App Link. | ||
| Otherwise, it is the url that created the target. | ||
| */ | ||
| @property (nonatomic, strong, readonly) NSURL *targetURL; | ||
|
|
||
| /*! | ||
| Gets the query parameters for the target, parsed into an NSDictionary. | ||
| */ | ||
| @property (nonatomic, strong, readonly) NSDictionary *targetQueryParameters; | ||
|
|
||
| /*! | ||
| If this link target is an App Link, this is the data found in al_applink_data. | ||
| Otherwise, it is nil. | ||
| */ | ||
| @property (nonatomic, strong, readonly) NSDictionary *appLinkData; | ||
|
|
||
| /*! | ||
| If this link target is an App Link, this is the data found in extras. | ||
| */ | ||
| @property (nonatomic, strong, readonly) NSDictionary *appLinkExtras; | ||
|
|
||
| /*! | ||
| The App Link indicating how to navigate back to the referer app, if any. | ||
| */ | ||
| @property (nonatomic, strong, readonly) BFAppLink *appLinkReferer; | ||
|
|
||
| /*! | ||
| The URL that was used to create this BFURL. | ||
| */ | ||
| @property (nonatomic, strong, readonly) NSURL *inputURL; | ||
|
|
||
| /*! | ||
| The query parameters of the inputURL, parsed into an NSDictionary. | ||
| */ | ||
| @property (nonatomic, strong, readonly) NSDictionary *inputQueryParameters; | ||
|
|
||
| @end |
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * Copyright (c) 2014, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. An additional grant | ||
| * of patent rights can be found in the PATENTS file in the same directory. | ||
| * | ||
| */ | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #import <Bolts/BFAppLinkResolving.h> | ||
|
|
||
| /*! | ||
| A reference implementation for an App Link resolver that uses a hidden UIWebView | ||
| to parse the HTML containing App Link metadata. | ||
| */ | ||
| @interface BFWebViewAppLinkResolver : NSObject <BFAppLinkResolving> | ||
|
|
||
| /*! | ||
| Gets the instance of a BFWebViewAppLinkResolver. | ||
| */ | ||
| + (instancetype)sharedInstance; | ||
|
|
||
| @end |
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright (c) 2014, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. An additional grant | ||
| * of patent rights can be found in the PATENTS file in the same directory. | ||
| * | ||
| */ | ||
|
|
||
| #import <Bolts/BoltsVersion.h> | ||
| #import <Bolts/BFCancellationToken.h> | ||
| #import <Bolts/BFCancellationTokenRegistration.h> | ||
| #import <Bolts/BFCancellationTokenSource.h> | ||
| #import <Bolts/BFExecutor.h> | ||
| #import <Bolts/BFTask.h> | ||
| #import <Bolts/BFTaskCompletionSource.h> | ||
|
|
||
| #if __has_include(<Bolts/BFAppLink.h>) && TARGET_OS_IPHONE && !TARGET_OS_WATCH && !TARGET_OS_TV | ||
| #import <Bolts/BFAppLink.h> | ||
| #import <Bolts/BFAppLinkNavigation.h> | ||
| #import <Bolts/BFAppLinkResolving.h> | ||
| #import <Bolts/BFAppLinkReturnToRefererController.h> | ||
| #import <Bolts/BFAppLinkReturnToRefererView.h> | ||
| #import <Bolts/BFAppLinkTarget.h> | ||
| #import <Bolts/BFMeasurementEvent.h> | ||
| #import <Bolts/BFURL.h> | ||
| #import <Bolts/BFWebViewAppLinkResolver.h> | ||
| #endif | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @interface Bolts : NSObject | ||
|
|
||
| /*! | ||
| Returns the version of the Bolts Framework as an NSString. | ||
| @returns The NSString representation of the current version. | ||
| */ | ||
| + (NSString *)version; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END |
| @@ -0,0 +1 @@ | ||
| #define BOLTS_VERSION @"1.6.0" |
| @@ -0,0 +1,15 @@ | ||
| framework module Bolts { | ||
| umbrella header "Bolts.h" | ||
|
|
||
| export * | ||
| module * { export * } | ||
|
|
||
| explicit module BFAppLinkResolving { | ||
| header "BFAppLinkResolving.h" | ||
| export * | ||
| } | ||
| explicit module BFWebViewAppLinkResolver { | ||
| header "BFWebViewAppLinkResolver.h" | ||
| export * | ||
| } | ||
| } |
| @@ -0,0 +1,20 @@ | ||
| // | ||
| // Constants.swift | ||
| // sportshowcase | ||
| // | ||
| // Created by Jesse Tellez on 3/30/16. | ||
| // Copyright © 2016 SunCat Developers. All rights reserved. | ||
| // | ||
| import Foundation | ||
| import UIKit | ||
|
|
||
|
|
||
| let SHADOW_COLOR: CGFloat = 157.0 / 255.0 | ||
| let KEY_UID = "uid" | ||
|
|
||
| //Segues | ||
| let SEGUE_LOGGED_IN = "loggedIn" | ||
|
|
||
| //Status Codes | ||
| let STATUS_ACCOUNT_NONEXIST = -8 |
| @@ -0,0 +1,43 @@ | ||
| // | ||
| // DataService.swift | ||
| // sportshowcase | ||
| // | ||
| // Created by Jesse Tellez on 3/31/16. | ||
| // Copyright © 2016 SunCat Developers. All rights reserved. | ||
| // | ||
| import Foundation | ||
| import Firebase | ||
|
|
||
| let URL_BASE = "https://sportshowcase.firebaseio.com" | ||
|
|
||
| class DataService { | ||
| //create a static vairable (only one instance in memory) | ||
| static let ds = DataService() | ||
|
|
||
|
|
||
|
|
||
| private var _REF_BASE = Firebase(url: URL_BASE) | ||
|
|
||
| private var _REF_POSTS = Firebase(url: "\(URL_BASE)/posts") | ||
|
|
||
| private var _REF_USERS = Firebase(url: "\(URL_BASE)/users") | ||
|
|
||
| var REF_BASE: Firebase { | ||
| return _REF_BASE | ||
| } | ||
|
|
||
| var REF_USERS: Firebase { | ||
| return _REF_USERS | ||
| } | ||
|
|
||
| var REF_POSTS: Firebase { | ||
| return _REF_POSTS | ||
| } | ||
|
|
||
| func createFireBaseUser(uid: String, user: Dictionary<String, String>) { | ||
|
|
||
| //what ever values are in the user dictionary, it updates them and adds a new user with them | ||
| REF_USERS.childByAppendingPath(uid).setValue(user) | ||
| } | ||
| } |
| @@ -0,0 +1,166 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #import <FBSDKCoreKit/FBSDKCopying.h> | ||
| #import <FBSDKCoreKit/FBSDKGraphRequestConnection.h> | ||
| #import <FBSDKCoreKit/FBSDKMacros.h> | ||
|
|
||
| /*! | ||
| @abstract Notification indicating that the `currentAccessToken` has changed. | ||
| @discussion the userInfo dictionary of the notification will contain keys | ||
| `FBSDKAccessTokenChangeOldKey` and | ||
| `FBSDKAccessTokenChangeNewKey`. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeNotification; | ||
|
|
||
| /*! | ||
| @abstract A key in the notification's userInfo that will be set | ||
| if and only if the user ID changed between the old and new tokens. | ||
| @discussion Token refreshes can occur automatically with the SDK | ||
| which do not change the user. If you're only interested in user | ||
| changes (such as logging out), you should check for the existence | ||
| of this key. The value is a NSNumber with a boolValue. | ||
| On a fresh start of the app where the SDK reads in the cached value | ||
| of an access token, this key will also exist since the access token | ||
| is moving from a null state (no user) to a non-null state (user). | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeUserID; | ||
|
|
||
| /* | ||
| @abstract key in notification's userInfo object for getting the old token. | ||
| @discussion If there was no old token, the key will not be present. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeOldKey; | ||
|
|
||
| /* | ||
| @abstract key in notification's userInfo object for getting the new token. | ||
| @discussion If there is no new token, the key will not be present. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeNewKey; | ||
|
|
||
|
|
||
| /*! | ||
| @class FBSDKAccessToken | ||
| @abstract Represents an immutable access token for using Facebook services. | ||
| */ | ||
| @interface FBSDKAccessToken : NSObject<FBSDKCopying, NSSecureCoding> | ||
|
|
||
| /*! | ||
| @abstract Returns the app ID. | ||
| */ | ||
| @property (readonly, copy, nonatomic) NSString *appID; | ||
|
|
||
| /*! | ||
| @abstract Returns the known declined permissions. | ||
| */ | ||
| @property (readonly, copy, nonatomic) NSSet *declinedPermissions; | ||
|
|
||
| /*! | ||
| @abstract Returns the expiration date. | ||
| */ | ||
| @property (readonly, copy, nonatomic) NSDate *expirationDate; | ||
|
|
||
| /*! | ||
| @abstract Returns the known granted permissions. | ||
| */ | ||
| @property (readonly, copy, nonatomic) NSSet *permissions; | ||
|
|
||
| /*! | ||
| @abstract Returns the date the token was last refreshed. | ||
| */ | ||
| @property (readonly, copy, nonatomic) NSDate *refreshDate; | ||
|
|
||
| /*! | ||
| @abstract Returns the opaque token string. | ||
| */ | ||
| @property (readonly, copy, nonatomic) NSString *tokenString; | ||
|
|
||
| /*! | ||
| @abstract Returns the user ID. | ||
| */ | ||
| @property (readonly, copy, nonatomic) NSString *userID; | ||
|
|
||
| - (instancetype)init NS_UNAVAILABLE; | ||
| + (instancetype)new NS_UNAVAILABLE; | ||
|
|
||
| /*! | ||
| @abstract Initializes a new instance. | ||
| @param tokenString the opaque token string. | ||
| @param permissions the granted permissions. Note this is converted to NSSet and is only | ||
| an NSArray for the convenience of literal syntax. | ||
| @param declinedPermissions the declined permissions. Note this is converted to NSSet and is only | ||
| an NSArray for the convenience of literal syntax. | ||
| @param appID the app ID. | ||
| @param userID the user ID. | ||
| @param expirationDate the optional expiration date (defaults to distantFuture). | ||
| @param refreshDate the optional date the token was last refreshed (defaults to today). | ||
| @discussion This initializer should only be used for advanced apps that | ||
| manage tokens explicitly. Typical login flows only need to use `FBSDKLoginManager` | ||
| along with `+currentAccessToken`. | ||
| */ | ||
| - (instancetype)initWithTokenString:(NSString *)tokenString | ||
| permissions:(NSArray *)permissions | ||
| declinedPermissions:(NSArray *)declinedPermissions | ||
| appID:(NSString *)appID | ||
| userID:(NSString *)userID | ||
| expirationDate:(NSDate *)expirationDate | ||
| refreshDate:(NSDate *)refreshDate | ||
| NS_DESIGNATED_INITIALIZER; | ||
|
|
||
| /*! | ||
| @abstract Convenience getter to determine if a permission has been granted | ||
| @param permission The permission to check. | ||
| */ | ||
| - (BOOL)hasGranted:(NSString *)permission; | ||
|
|
||
| /*! | ||
| @abstract Compares the receiver to another FBSDKAccessToken | ||
| @param token The other token | ||
| @return YES if the receiver's values are equal to the other token's values; otherwise NO | ||
| */ | ||
| - (BOOL)isEqualToAccessToken:(FBSDKAccessToken *)token; | ||
|
|
||
| /*! | ||
| @abstract Returns the "global" access token that represents the currently logged in user. | ||
| @discussion The `currentAccessToken` is a convenient representation of the token of the | ||
| current user and is used by other SDK components (like `FBSDKLoginManager`). | ||
| */ | ||
| + (FBSDKAccessToken *)currentAccessToken; | ||
|
|
||
| /*! | ||
| @abstract Sets the "global" access token that represents the currently logged in user. | ||
| @param token The access token to set. | ||
| @discussion This will broadcast a notification and save the token to the app keychain. | ||
| */ | ||
| + (void)setCurrentAccessToken:(FBSDKAccessToken *)token; | ||
|
|
||
| /*! | ||
| @abstract Refresh the current access token's permission state and extend the token's expiration date, | ||
| if possible. | ||
| @param completionHandler an optional callback handler that can surface any errors related to permission refreshing. | ||
| @discussion On a successful refresh, the currentAccessToken will be updated so you typically only need to | ||
| observe the `FBSDKAccessTokenDidChangeNotification` notification. | ||
| If a token is already expired, it cannot be refreshed. | ||
| */ | ||
| + (void)refreshCurrentAccessToken:(FBSDKGraphRequestHandler)completionHandler; | ||
|
|
||
| @end |
| @@ -0,0 +1,82 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| @class BFTask; | ||
|
|
||
| // Check if Bolts.framework is available for import | ||
| #if __has_include(<Bolts/BFAppLinkResolving.h>) | ||
| // Import it if it's available | ||
| # import <Bolts/BFAppLinkResolving.h> | ||
| #else | ||
| // Otherwise - redeclare BFAppLinkResolving protocol to resolve the problem of missing symbols | ||
| // Please note: Bolts.framework is still required for AppLink resolving to work, | ||
| // but this allows FBSDKCoreKit to weakly link Bolts.framework as well as this enables clang modulemaps to work. | ||
|
|
||
| /*! | ||
| Implement this protocol to provide an alternate strategy for resolving | ||
| App Links that may include pre-fetching, caching, or querying for App Link | ||
| data from an index provided by a service provider. | ||
| */ | ||
| @protocol BFAppLinkResolving <NSObject> | ||
|
|
||
| /*! | ||
| Asynchronously resolves App Link data for a given URL. | ||
| @param url The URL to resolve into an App Link. | ||
| @returns A BFTask that will return a BFAppLink for the given URL. | ||
| */ | ||
| - (BFTask *)appLinkFromURLInBackground:(NSURL *)url; | ||
|
|
||
| @end | ||
|
|
||
| #endif | ||
|
|
||
| /*! | ||
| @class FBSDKAppLinkResolver | ||
| @abstract | ||
| Provides an implementation of the BFAppLinkResolving protocol that uses the Facebook App Link | ||
| Index API to resolve App Links given a URL. It also provides an additional helper method that can resolve | ||
| multiple App Links in a single call. | ||
| @discussion | ||
| Usage of this type requires a client token. See `[FBSDKSettings setClientToken:]` and linking | ||
| Bolts.framework | ||
| */ | ||
| @interface FBSDKAppLinkResolver : NSObject<BFAppLinkResolving> | ||
|
|
||
| /*! | ||
| @abstract Asynchronously resolves App Link data for multiple URLs. | ||
| @param urls An array of NSURLs to resolve into App Links. | ||
| @returns A BFTask that will return dictionary mapping input NSURLs to their | ||
| corresponding BFAppLink. | ||
| @discussion | ||
| You should set the client token before making this call. See `[FBSDKSettings setClientToken:]` | ||
| */ | ||
| - (BFTask *)appLinksFromURLsInBackground:(NSArray *)urls; | ||
|
|
||
| /*! | ||
| @abstract Allocates and initializes a new instance of FBSDKAppLinkResolver. | ||
| */ | ||
| + (instancetype)resolver; | ||
|
|
||
| @end |
| @@ -0,0 +1,55 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| /*! | ||
| @abstract Describes the callback for fetchDeferredAppLink. | ||
| @param url the url representing the deferred App Link | ||
| @param error the error during the request, if any | ||
| @discussion The url may also have a fb_click_time_utc query parameter that | ||
| represents when the click occurred that caused the deferred App Link to be created. | ||
| */ | ||
| typedef void (^FBSDKDeferredAppLinkHandler)(NSURL *url, NSError *error); | ||
|
|
||
| /*! | ||
| @abstract Class containing App Links related utility methods. | ||
| */ | ||
| @interface FBSDKAppLinkUtility : NSObject | ||
|
|
||
| /*! | ||
| @abstract | ||
| Call this method from the main thread to fetch deferred applink data if you use Mobile App | ||
| Engagement Ads (https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads-engagement). | ||
| This may require a network round trip. If successful, the handler is invoked with the link | ||
| data (this will only return a valid URL once, and future calls will result in a nil URL | ||
| value in the callback). | ||
| @param handler the handler to be invoked if there is deferred App Link data | ||
| @discussion The handler may contain an NSError instance to capture any errors. In the | ||
| common case where there simply was no app link data, the NSError instance will be nil. | ||
| This method should only be called from a location that occurs after any launching URL has | ||
| been processed (e.g., you should call this method from your application delegate's | ||
| applicationDidBecomeActive:). | ||
| */ | ||
| + (void)fetchDeferredAppLink:(FBSDKDeferredAppLinkHandler)handler; | ||
|
|
||
| @end |
| @@ -0,0 +1,74 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
|
|
||
| /*! | ||
| @class FBSDKApplicationDelegate | ||
| @abstract | ||
| The FBSDKApplicationDelegate is designed to post process the results from Facebook Login | ||
| or Facebook Dialogs (or any action that requires switching over to the native Facebook | ||
| app or Safari). | ||
| @discussion | ||
| The methods in this class are designed to mirror those in UIApplicationDelegate, and you | ||
| should call them in the respective methods in your AppDelegate implementation. | ||
| */ | ||
| @interface FBSDKApplicationDelegate : NSObject | ||
|
|
||
| /*! | ||
| @abstract Gets the singleton instance. | ||
| */ | ||
| + (instancetype)sharedInstance; | ||
|
|
||
| /*! | ||
| @abstract | ||
| Call this method from the [UIApplicationDelegate application:openURL:sourceApplication:annotation:] method | ||
| of the AppDelegate for your app. It should be invoked for the proper processing of responses during interaction | ||
| with the native Facebook app or Safari as part of SSO authorization flow or Facebook dialogs. | ||
| @param application The application as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. | ||
| @param url The URL as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. | ||
| @param sourceApplication The sourceApplication as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. | ||
| @param annotation The annotation as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. | ||
| @return YES if the url was intended for the Facebook SDK, NO if not. | ||
| */ | ||
| - (BOOL)application:(UIApplication *)application | ||
| openURL:(NSURL *)url | ||
| sourceApplication:(NSString *)sourceApplication | ||
| annotation:(id)annotation; | ||
|
|
||
| /*! | ||
| @abstract | ||
| Call this method from the [UIApplicationDelegate application:didFinishLaunchingWithOptions:] method | ||
| of the AppDelegate for your app. It should be invoked for the proper use of the Facebook SDK. | ||
| @param application The application as passed to [UIApplicationDelegate application:didFinishLaunchingWithOptions:]. | ||
| @param launchOptions The launchOptions as passed to [UIApplicationDelegate application:didFinishLaunchingWithOptions:]. | ||
| @return YES if the url was intended for the Facebook SDK, NO if not. | ||
| */ | ||
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; | ||
|
|
||
| @end |
| @@ -0,0 +1,26 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
|
|
||
| /*! | ||
| @abstract A base class for common SDK buttons. | ||
| */ | ||
| @interface FBSDKButton : UIButton | ||
|
|
||
| @end |
| @@ -0,0 +1,210 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #import <FBSDKCoreKit/FBSDKMacros.h> | ||
|
|
||
| /*! | ||
| @abstract The error domain for all errors from FBSDKCoreKit. | ||
| @discussion Error codes from the SDK in the range 0-99 are reserved for this domain. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKErrorDomain; | ||
|
|
||
| /*! | ||
| @typedef NS_ENUM(NSInteger, FBSDKErrorCode) | ||
| @abstract Error codes for FBSDKErrorDomain. | ||
| */ | ||
| typedef NS_ENUM(NSInteger, FBSDKErrorCode) | ||
| { | ||
| /*! | ||
| @abstract Reserved. | ||
| */ | ||
| FBSDKReservedErrorCode = 0, | ||
|
|
||
| /*! | ||
| @abstract The error code for errors from invalid encryption on incoming encryption URLs. | ||
| */ | ||
| FBSDKEncryptionErrorCode, | ||
|
|
||
| /*! | ||
| @abstract The error code for errors from invalid arguments to SDK methods. | ||
| */ | ||
| FBSDKInvalidArgumentErrorCode, | ||
|
|
||
| /*! | ||
| @abstract The error code for unknown errors. | ||
| */ | ||
| FBSDKUnknownErrorCode, | ||
|
|
||
| /*! | ||
| @abstract A request failed due to a network error. Use NSUnderlyingErrorKey to retrieve | ||
| the error object from the NSURLConnection for more information. | ||
| */ | ||
| FBSDKNetworkErrorCode, | ||
|
|
||
| /*! | ||
| @abstract The error code for errors encounted during an App Events flush. | ||
| */ | ||
| FBSDKAppEventsFlushErrorCode, | ||
|
|
||
| /*! | ||
| @abstract An endpoint that returns a binary response was used with FBSDKGraphRequestConnection. | ||
| @discussion Endpoints that return image/jpg, etc. should be accessed using NSURLRequest | ||
| */ | ||
| FBSDKGraphRequestNonTextMimeTypeReturnedErrorCode, | ||
|
|
||
| /*! | ||
| @abstract The operation failed because the server returned an unexpected response. | ||
| @discussion You can get this error if you are not using the most recent SDK, or you are accessing a version of the | ||
| Graph API incompatible with the current SDK. | ||
| */ | ||
| FBSDKGraphRequestProtocolMismatchErrorCode, | ||
|
|
||
| /*! | ||
| @abstract The Graph API returned an error. | ||
| @discussion See below for useful userInfo keys (beginning with FBSDKGraphRequestError*) | ||
| */ | ||
| FBSDKGraphRequestGraphAPIErrorCode, | ||
|
|
||
| /*! | ||
| @abstract The specified dialog configuration is not available. | ||
| @discussion This error may signify that the configuration for the dialogs has not yet been downloaded from the server | ||
| or that the dialog is unavailable. Subsequent attempts to use the dialog may succeed as the configuration is loaded. | ||
| */ | ||
| FBSDKDialogUnavailableErrorCode, | ||
|
|
||
| /*! | ||
| @abstract Indicates an operation failed because a required access token was not found. | ||
| */ | ||
| FBSDKAccessTokenRequiredErrorCode, | ||
|
|
||
| /*! | ||
| @abstract Indicates an app switch (typically for a dialog) failed because the destination app is out of date. | ||
| */ | ||
| FBSDKAppVersionUnsupportedErrorCode, | ||
|
|
||
| /*! | ||
| @abstract Indicates an app switch to the browser (typically for a dialog) failed. | ||
| */ | ||
| FBSDKBrowswerUnavailableErrorCode, | ||
| }; | ||
|
|
||
| /*! | ||
| @typedef NS_ENUM(NSUInteger, FBSDKGraphRequestErrorCategory) | ||
| @abstract Describes the category of Facebook error. See `FBSDKGraphRequestErrorCategoryKey`. | ||
| */ | ||
| typedef NS_ENUM(NSUInteger, FBSDKGraphRequestErrorCategory) | ||
| { | ||
| /*! The default error category that is not known to be recoverable. Check `FBSDKLocalizedErrorDescriptionKey` for a user facing message. */ | ||
| FBSDKGraphRequestErrorCategoryOther = 0, | ||
| /*! 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. */ | ||
| FBSDKGraphRequestErrorCategoryTransient = 1, | ||
| /*! 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. */ | ||
| FBSDKGraphRequestErrorCategoryRecoverable = 2 | ||
| }; | ||
|
|
||
| /* | ||
| @methodgroup error userInfo keys | ||
| */ | ||
|
|
||
| /*! | ||
| @abstract The userInfo key for the invalid collection for errors with FBSDKInvalidArgumentErrorCode. | ||
| @discussion If the invalid argument is a collection, the collection can be found with this key and the individual | ||
| invalid item can be found with FBSDKErrorArgumentValueKey. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKErrorArgumentCollectionKey; | ||
|
|
||
| /*! | ||
| @abstract The userInfo key for the invalid argument name for errors with FBSDKInvalidArgumentErrorCode. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKErrorArgumentNameKey; | ||
|
|
||
| /*! | ||
| @abstract The userInfo key for the invalid argument value for errors with FBSDKInvalidArgumentErrorCode. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKErrorArgumentValueKey; | ||
|
|
||
| /*! | ||
| @abstract The userInfo key for the message for developers in NSErrors that originate from the SDK. | ||
| @discussion The developer message will not be localized and is not intended to be presented within the app. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKErrorDeveloperMessageKey; | ||
|
|
||
| /*! | ||
| @abstract The userInfo key describing a localized description that can be presented to the user. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKErrorLocalizedDescriptionKey; | ||
|
|
||
| /*! | ||
| @abstract The userInfo key describing a localized title that can be presented to the user, used with `FBSDKLocalizedErrorDescriptionKey`. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKErrorLocalizedTitleKey; | ||
|
|
||
| /* | ||
| @methodgroup FBSDKGraphRequest error userInfo keys | ||
| */ | ||
|
|
||
| /*! | ||
| @abstract The userInfo key describing the error category, for error recovery purposes. | ||
| @discussion See `FBSDKGraphErrorRecoveryProcessor` and `[FBSDKGraphRequest disableErrorRecovery]`. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorCategoryKey; | ||
|
|
||
| /* | ||
| @abstract The userInfo key for the Graph API error code. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorGraphErrorCode; | ||
|
|
||
| /* | ||
| @abstract The userInfo key for the Graph API error subcode. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorGraphErrorSubcode; | ||
|
|
||
| /* | ||
| @abstract The userInfo key for the HTTP status code. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorHTTPStatusCodeKey; | ||
|
|
||
| /* | ||
| @abstract The userInfo key for the raw JSON response. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorParsedJSONResponseKey; | ||
|
|
||
| /*! | ||
| @abstract a formal protocol very similar to the informal protocol NSErrorRecoveryAttempting | ||
| */ | ||
| @protocol FBSDKErrorRecoveryAttempting<NSObject> | ||
|
|
||
| /*! | ||
| @abstract attempt the recovery | ||
| @param error the error | ||
| @param recoveryOptionIndex the selected option index | ||
| @param delegate the delegate | ||
| @param didRecoverSelector the callback selector, see discussion. | ||
| @param contextInfo context info to pass back to callback selector, see discussion. | ||
| @discussion | ||
| 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: | ||
| - (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo; | ||
| The value passed for didRecover must be YES if error recovery was completely successful, NO otherwise. | ||
| */ | ||
| - (void)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex delegate:(id)delegate didRecoverSelector:(SEL)didRecoverSelector contextInfo:(void *)contextInfo; | ||
|
|
||
| @end |
| @@ -0,0 +1,33 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| /*! | ||
| @abstract Extension protocol for NSCopying that adds the copy method, which is implemented on NSObject. | ||
| @discussion NSObject<NSCopying> implicitly conforms to this protocol. | ||
| */ | ||
| @protocol FBSDKCopying <NSCopying, NSObject> | ||
|
|
||
| /*! | ||
| @abstract Implemented by NSObject as a convenience to copyWithZone:. | ||
| @return A copy of the receiver. | ||
| */ | ||
| - (id)copy; | ||
|
|
||
| @end |
| @@ -0,0 +1,45 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
|
|
||
| #import <FBSDKCoreKit/FBSDKAccessToken.h> | ||
| #import <FBSDKCoreKit/FBSDKAppEvents.h> | ||
| #import <FBSDKCoreKit/FBSDKApplicationDelegate.h> | ||
| #import <FBSDKCoreKit/FBSDKButton.h> | ||
| #import <FBSDKCoreKit/FBSDKConstants.h> | ||
| #import <FBSDKCoreKit/FBSDKCopying.h> | ||
| #import <FBSDKCoreKit/FBSDKGraphRequest.h> | ||
| #import <FBSDKCoreKit/FBSDKGraphRequestConnection.h> | ||
| #import <FBSDKCoreKit/FBSDKGraphRequestDataAttachment.h> | ||
| #import <FBSDKCoreKit/FBSDKMacros.h> | ||
| #import <FBSDKCoreKit/FBSDKSettings.h> | ||
| #import <FBSDKCoreKit/FBSDKTestUsersManager.h> | ||
| #import <FBSDKCoreKit/FBSDKUtility.h> | ||
|
|
||
| #if !TARGET_OS_TV | ||
| #import <FBSDKCoreKit/FBSDKAppLinkResolver.h> | ||
| #import <FBSDKCoreKit/FBSDKAppLinkUtility.h> | ||
| #import <FBSDKCoreKit/FBSDKGraphErrorRecoveryProcessor.h> | ||
| #import <FBSDKCoreKit/FBSDKMutableCopying.h> | ||
| #import <FBSDKCoreKit/FBSDKProfile.h> | ||
| #import <FBSDKCoreKit/FBSDKProfilePictureView.h> | ||
| #endif | ||
|
|
||
| #define FBSDK_VERSION_STRING @"4.10.1" | ||
| #define FBSDK_TARGET_PLATFORM_VERSION @"v2.5" |
| @@ -0,0 +1,97 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #import "FBSDKConstants.h" | ||
|
|
||
| @class FBSDKGraphErrorRecoveryProcessor; | ||
| @class FBSDKGraphRequest; | ||
|
|
||
| /*! | ||
| @abstract Defines a delegate for `FBSDKGraphErrorRecoveryProcessor`. | ||
| */ | ||
| @protocol FBSDKGraphErrorRecoveryProcessorDelegate<NSObject> | ||
|
|
||
| /*! | ||
| @abstract Indicates the error recovery has been attempted. | ||
| @param processor the processor instance. | ||
| @param didRecover YES if the recovery was successful. | ||
| @param error the error that that was attempted to be recovered from. | ||
| */ | ||
| - (void)processorDidAttemptRecovery:(FBSDKGraphErrorRecoveryProcessor *)processor didRecover:(BOOL)didRecover error:(NSError *)error; | ||
|
|
||
| @optional | ||
| /*! | ||
| @abstract Indicates the processor is about to process the error. | ||
| @param processor the processor instance. | ||
| @param error the error is about to be processed. | ||
| @discussion return NO if the processor should not process the error. For example, | ||
| if you want to prevent alerts of localized messages but otherwise perform retries and recoveries, | ||
| you could return NO for errors where userInfo[FBSDKGraphRequestErrorCategoryKey] equal to FBSDKGraphRequestErrorCategoryOther | ||
| */ | ||
| - (BOOL)processorWillProcessError:(FBSDKGraphErrorRecoveryProcessor *)processor error:(NSError *)error; | ||
|
|
||
| @end | ||
|
|
||
| /*! | ||
| @abstract Defines a type that can process Facebook NSErrors with best practices. | ||
| @discussion Facebook NSErrors can contain FBSDKErrorRecoveryAttempting instances to recover from errors, or | ||
| localized messages to present to the user. This class will process the instances as follows: | ||
| 1. If the error is temporary as indicated by FBSDKGraphRequestErrorCategoryKey, assume the recovery succeeded and | ||
| notify the delegate. | ||
| 2. If a FBSDKErrorRecoveryAttempting instance is available, display an alert (dispatched to main thread) | ||
| with the recovery options and call the instance's [ attemptRecoveryFromError:optionIndex:...]. | ||
| 3. If a FBSDKErrorRecoveryAttempting is not available, check the userInfo for FBSDKLocalizedErrorDescriptionKey | ||
| and present that in an alert (dispatched to main thread). | ||
| By default, FBSDKGraphRequests use this type to process errors and retry the request upon a successful | ||
| recovery. | ||
| Note that Facebook recovery attempters can present UI or even cause app switches (such as to login). Any such | ||
| work is dispatched to the main thread (therefore your request handlers may then run on the main thread). | ||
| Login recovery requires FBSDKLoginKit. Login will use FBSDKLoginBehaviorNative and will prompt the user | ||
| for all permissions last granted. If any are declined on the new request, the recovery is not successful but | ||
| the `[FBSDKAccessToken currentAccessToken]` might still have been updated. | ||
| . | ||
| */ | ||
| @interface FBSDKGraphErrorRecoveryProcessor : NSObject | ||
|
|
||
| /*! | ||
| @abstract Gets the delegate. Note this is a strong reference, and is nil'ed out after recovery is complete. | ||
| */ | ||
| @property (nonatomic, strong, readonly) id<FBSDKGraphErrorRecoveryProcessorDelegate>delegate; | ||
|
|
||
| /*! | ||
| @abstract Attempts to process the error, return YES if the error can be processed. | ||
| @param error the error to process. | ||
| @param request the relateed request that may be reissued. | ||
| @param delegate the delegate that will be retained until recovery is complete. | ||
| */ | ||
| - (BOOL)processError:(NSError *)error request:(FBSDKGraphRequest *)request delegate:(id<FBSDKGraphErrorRecoveryProcessorDelegate>) delegate; | ||
|
|
||
| /*! | ||
| @abstract The callback for FBSDKErrorRecoveryAttempting | ||
| @param didRecover if the recovery succeeded | ||
| @param contextInfo unused | ||
| */ | ||
| - (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo; | ||
|
|
||
| @end |
| @@ -0,0 +1,120 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #import <FBSDKCoreKit/FBSDKGraphRequestConnection.h> | ||
|
|
||
| @class FBSDKAccessToken; | ||
|
|
||
| /*! | ||
| @abstract Represents a request to the Facebook Graph API. | ||
| @discussion `FBSDKGraphRequest` encapsulates the components of a request (the | ||
| Graph API path, the parameters, error recovery behavior) and should be | ||
| used in conjunction with `FBSDKGraphRequestConnection` to issue the request. | ||
| Nearly all Graph APIs require an access token. Unless specified, the | ||
| `[FBSDKAccessToken currentAccessToken]` is used. Therefore, most requests | ||
| will require login first (see `FBSDKLoginManager` in FBSDKLoginKit.framework). | ||
| A `- start` method is provided for convenience for single requests. | ||
| By default, FBSDKGraphRequest will attempt to recover any errors returned from | ||
| Facebook. You can disable this via `disableErrorRecovery:`. | ||
| @see FBSDKGraphErrorRecoveryProcessor | ||
| */ | ||
| @interface FBSDKGraphRequest : NSObject | ||
|
|
||
| /*! | ||
| @abstract Initializes a new instance that use use `[FBSDKAccessToken currentAccessToken]`. | ||
| @param graphPath the graph path (e.g., @"me"). | ||
| @param parameters the optional parameters dictionary. | ||
| */ | ||
| - (instancetype)initWithGraphPath:(NSString *)graphPath | ||
| parameters:(NSDictionary *)parameters; | ||
|
|
||
| /*! | ||
| @abstract Initializes a new instance that use use `[FBSDKAccessToken currentAccessToken]`. | ||
| @param graphPath the graph path (e.g., @"me"). | ||
| @param parameters the optional parameters dictionary. | ||
| @param HTTPMethod the optional HTTP method. nil defaults to @"GET". | ||
| */ | ||
| - (instancetype)initWithGraphPath:(NSString *)graphPath | ||
| parameters:(NSDictionary *)parameters | ||
| HTTPMethod:(NSString *)HTTPMethod; | ||
|
|
||
| /*! | ||
| @abstract Initializes a new instance. | ||
| @param graphPath the graph path (e.g., @"me"). | ||
| @param parameters the optional parameters dictionary. | ||
| @param tokenString the token string to use. Specifying nil will cause no token to be used. | ||
| @param version the optional Graph API version (e.g., @"v2.0"). nil defaults to FBSDK_TARGET_PLATFORM_VERSION. | ||
| @param HTTPMethod the optional HTTP method (e.g., @"POST"). nil defaults to @"GET". | ||
| */ | ||
| - (instancetype)initWithGraphPath:(NSString *)graphPath | ||
| parameters:(NSDictionary *)parameters | ||
| tokenString:(NSString *)tokenString | ||
| version:(NSString *)version | ||
| HTTPMethod:(NSString *)HTTPMethod | ||
| NS_DESIGNATED_INITIALIZER; | ||
|
|
||
| /*! | ||
| @abstract The request parameters. | ||
| */ | ||
| @property (nonatomic, strong, readonly) NSMutableDictionary *parameters; | ||
|
|
||
| /*! | ||
| @abstract The access token string used by the request. | ||
| */ | ||
| @property (nonatomic, copy, readonly) NSString *tokenString; | ||
|
|
||
| /*! | ||
| @abstract The Graph API endpoint to use for the request, for example "me". | ||
| */ | ||
| @property (nonatomic, copy, readonly) NSString *graphPath; | ||
|
|
||
| /*! | ||
| @abstract The HTTPMethod to use for the request, for example "GET" or "POST". | ||
| */ | ||
| @property (nonatomic, copy, readonly) NSString *HTTPMethod; | ||
|
|
||
| /*! | ||
| @abstract The Graph API version to use (e.g., "v2.0") | ||
| */ | ||
| @property (nonatomic, copy, readonly) NSString *version; | ||
|
|
||
| /*! | ||
| @abstract If set, disables the automatic error recovery mechanism. | ||
| @param disable whether to disable the automatic error recovery mechanism | ||
| @discussion By default, non-batched FBSDKGraphRequest instances will automatically try to recover | ||
| from errors by constructing a `FBSDKGraphErrorRecoveryProcessor` instance that | ||
| re-issues the request on successful recoveries. The re-issued request will call the same | ||
| handler as the receiver but may occur with a different `FBSDKGraphRequestConnection` instance. | ||
| This will override [FBSDKSettings setGraphErrorRecoveryDisabled:]. | ||
| */ | ||
| - (void)setGraphErrorRecoveryDisabled:(BOOL)disable; | ||
|
|
||
| /*! | ||
| @abstract Starts a connection to the Graph API. | ||
| @param handler The handler block to call when the request completes. | ||
| */ | ||
| - (FBSDKGraphRequestConnection *)startWithCompletionHandler:(FBSDKGraphRequestHandler)handler; | ||
|
|
||
| @end |
| @@ -0,0 +1,325 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #import <FBSDKCoreKit/FBSDKMacros.h> | ||
|
|
||
| @class FBSDKGraphRequest; | ||
| @class FBSDKGraphRequestConnection; | ||
|
|
||
| /*! | ||
| @typedef FBSDKGraphRequestHandler | ||
| @abstract | ||
| A block that is passed to addRequest to register for a callback with the results of that | ||
| request once the connection completes. | ||
| @discussion | ||
| Pass a block of this type when calling addRequest. This will be called once | ||
| the request completes. The call occurs on the UI thread. | ||
| @param connection The `FBSDKGraphRequestConnection` that sent the request. | ||
| @param result The result of the request. This is a translation of | ||
| JSON data to `NSDictionary` and `NSArray` objects. This | ||
| is nil if there was an error. | ||
| @param error The `NSError` representing any error that occurred. | ||
| */ | ||
| typedef void (^FBSDKGraphRequestHandler)(FBSDKGraphRequestConnection *connection, | ||
| id result, | ||
| NSError *error); | ||
|
|
||
| /*! | ||
| @protocol | ||
| @abstract | ||
| The `FBSDKGraphRequestConnectionDelegate` protocol defines the methods used to receive network | ||
| activity progress information from a <FBSDKGraphRequestConnection>. | ||
| */ | ||
| @protocol FBSDKGraphRequestConnectionDelegate <NSObject> | ||
|
|
||
| @optional | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| Tells the delegate the request connection will begin loading | ||
| @discussion | ||
| If the <FBSDKGraphRequestConnection> is created using one of the convenience factory methods prefixed with | ||
| start, the object returned from the convenience method has already begun loading and this method | ||
| will not be called when the delegate is set. | ||
| @param connection The request connection that is starting a network request | ||
| */ | ||
| - (void)requestConnectionWillBeginLoading:(FBSDKGraphRequestConnection *)connection; | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| Tells the delegate the request connection finished loading | ||
| @discussion | ||
| If the request connection completes without a network error occuring then this method is called. | ||
| Invocation of this method does not indicate success of every <FBSDKGraphRequest> made, only that the | ||
| request connection has no further activity. Use the error argument passed to the FBSDKGraphRequestHandler | ||
| block to determine success or failure of each <FBSDKGraphRequest>. | ||
| This method is invoked after the completion handler for each <FBSDKGraphRequest>. | ||
| @param connection The request connection that successfully completed a network request | ||
| */ | ||
| - (void)requestConnectionDidFinishLoading:(FBSDKGraphRequestConnection *)connection; | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| Tells the delegate the request connection failed with an error | ||
| @discussion | ||
| If the request connection fails with a network error then this method is called. The `error` | ||
| argument specifies why the network connection failed. The `NSError` object passed to the | ||
| FBSDKGraphRequestHandler block may contain additional information. | ||
| @param connection The request connection that successfully completed a network request | ||
| @param error The `NSError` representing the network error that occurred, if any. May be nil | ||
| in some circumstances. Consult the `NSError` for the <FBSDKGraphRequest> for reliable | ||
| failure information. | ||
| */ | ||
| - (void)requestConnection:(FBSDKGraphRequestConnection *)connection | ||
| didFailWithError:(NSError *)error; | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| Tells the delegate how much data has been sent and is planned to send to the remote host | ||
| @discussion | ||
| The byte count arguments refer to the aggregated <FBSDKGraphRequest> objects, not a particular <FBSDKGraphRequest>. | ||
| Like `NSURLConnection`, the values may change in unexpected ways if data needs to be resent. | ||
| @param connection The request connection transmitting data to a remote host | ||
| @param bytesWritten The number of bytes sent in the last transmission | ||
| @param totalBytesWritten The total number of bytes sent to the remote host | ||
| @param totalBytesExpectedToWrite The total number of bytes expected to send to the remote host | ||
| */ | ||
| - (void)requestConnection:(FBSDKGraphRequestConnection *)connection | ||
| didSendBodyData:(NSInteger)bytesWritten | ||
| totalBytesWritten:(NSInteger)totalBytesWritten | ||
| totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite; | ||
|
|
||
| @end | ||
|
|
||
| /*! | ||
| @class FBSDKGraphRequestConnection | ||
| @abstract | ||
| The `FBSDKGraphRequestConnection` represents a single connection to Facebook to service a request. | ||
| @discussion | ||
| The request settings are encapsulated in a reusable <FBSDKGraphRequest> object. The | ||
| `FBSDKGraphRequestConnection` object encapsulates the concerns of a single communication | ||
| e.g. starting a connection, canceling a connection, or batching requests. | ||
| */ | ||
| @interface FBSDKGraphRequestConnection : NSObject | ||
|
|
||
| /*! | ||
| @abstract | ||
| The delegate object that receives updates. | ||
| */ | ||
| @property (nonatomic, assign) id<FBSDKGraphRequestConnectionDelegate> delegate; | ||
|
|
||
| /*! | ||
| @abstract Gets or sets the timeout interval to wait for a response before giving up. | ||
| */ | ||
| @property (nonatomic) NSTimeInterval timeout; | ||
|
|
||
| /*! | ||
| @abstract | ||
| The raw response that was returned from the server. (readonly) | ||
| @discussion | ||
| This property can be used to inspect HTTP headers that were returned from | ||
| the server. | ||
| The property is nil until the request completes. If there was a response | ||
| then this property will be non-nil during the FBSDKGraphRequestHandler callback. | ||
| */ | ||
| @property (nonatomic, retain, readonly) NSHTTPURLResponse *URLResponse; | ||
|
|
||
| /*! | ||
| @methodgroup Class methods | ||
| */ | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| This method sets the default timeout on all FBSDKGraphRequestConnection instances. Defaults to 60 seconds. | ||
| @param defaultConnectionTimeout The timeout interval. | ||
| */ | ||
| + (void)setDefaultConnectionTimeout:(NSTimeInterval)defaultConnectionTimeout; | ||
|
|
||
| /*! | ||
| @methodgroup Adding requests | ||
| */ | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| This method adds an <FBSDKGraphRequest> object to this connection. | ||
| @param request A request to be included in the round-trip when start is called. | ||
| @param handler A handler to call back when the round-trip completes or times out. | ||
| @discussion | ||
| The completion handler is retained until the block is called upon the | ||
| completion or cancellation of the connection. | ||
| */ | ||
| - (void)addRequest:(FBSDKGraphRequest *)request | ||
| completionHandler:(FBSDKGraphRequestHandler)handler; | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| This method adds an <FBSDKGraphRequest> object to this connection. | ||
| @param request A request to be included in the round-trip when start is called. | ||
| @param handler A handler to call back when the round-trip completes or times out. | ||
| The handler will be invoked on the main thread. | ||
| @param name An optional name for this request. This can be used to feed | ||
| the results of one request to the input of another <FBSDKGraphRequest> in the same | ||
| `FBSDKGraphRequestConnection` as described in | ||
| [Graph API Batch Requests]( https://developers.facebook.com/docs/reference/api/batch/ ). | ||
| @discussion | ||
| The completion handler is retained until the block is called upon the | ||
| completion or cancellation of the connection. This request can be named | ||
| to allow for using the request's response in a subsequent request. | ||
| */ | ||
| - (void)addRequest:(FBSDKGraphRequest *)request | ||
| completionHandler:(FBSDKGraphRequestHandler)handler | ||
| batchEntryName:(NSString *)name; | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| This method adds an <FBSDKGraphRequest> object to this connection. | ||
| @param request A request to be included in the round-trip when start is called. | ||
| @param handler A handler to call back when the round-trip completes or times out. | ||
| @param batchParameters The optional dictionary of parameters to include for this request | ||
| as described in [Graph API Batch Requests]( https://developers.facebook.com/docs/reference/api/batch/ ). | ||
| Examples include "depends_on", "name", or "omit_response_on_success". | ||
| @discussion | ||
| The completion handler is retained until the block is called upon the | ||
| completion or cancellation of the connection. This request can be named | ||
| to allow for using the request's response in a subsequent request. | ||
| */ | ||
| - (void)addRequest:(FBSDKGraphRequest *)request | ||
| completionHandler:(FBSDKGraphRequestHandler)handler | ||
| batchParameters:(NSDictionary *)batchParameters; | ||
|
|
||
| /*! | ||
| @methodgroup Instance methods | ||
| */ | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| Signals that a connection should be logically terminated as the | ||
| application is no longer interested in a response. | ||
| @discussion | ||
| Synchronously calls any handlers indicating the request was cancelled. Cancel | ||
| does not guarantee that the request-related processing will cease. It | ||
| does promise that all handlers will complete before the cancel returns. A call to | ||
| cancel prior to a start implies a cancellation of all requests associated | ||
| with the connection. | ||
| */ | ||
| - (void)cancel; | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| This method starts a connection with the server and is capable of handling all of the | ||
| requests that were added to the connection. | ||
| @discussion By default, a connection is scheduled on the current thread in the default mode when it is created. | ||
| See `setDelegateQueue:` for other options. | ||
| This method cannot be called twice for an `FBSDKGraphRequestConnection` instance. | ||
| */ | ||
| - (void)start; | ||
|
|
||
| /*! | ||
| @abstract Determines the operation queue that is used to call methods on the connection's delegate. | ||
| @param queue The operation queue to use when calling delegate methods. | ||
| @discussion By default, a connection is scheduled on the current thread in the default mode when it is created. | ||
| You cannot reschedule a connection after it has started. | ||
| This is very similar to `[NSURLConnection setDelegateQueue:]`. | ||
| */ | ||
| - (void)setDelegateQueue:(NSOperationQueue *)queue; | ||
|
|
||
| /*! | ||
| @method | ||
| @abstract | ||
| Overrides the default version for a batch request | ||
| @discussion | ||
| The SDK automatically prepends a version part, such as "v2.0" to API paths in order to simplify API versioning | ||
| for applications. If you want to override the version part while using batch requests on the connection, call | ||
| this method to set the version for the batch request. | ||
| @param version This is a string in the form @"v2.0" which will be used for the version part of an API path | ||
| */ | ||
| - (void)overrideVersionPartWith:(NSString *)version; | ||
|
|
||
| @end | ||
|
|
||
| /*! | ||
| @abstract The key in the result dictionary for requests to old versions of the Graph API | ||
| whose response is not a JSON object. | ||
| @discussion When a request returns a non-JSON response (such as a "true" literal), that response | ||
| will be wrapped into a dictionary using this const as the key. This only applies for very few Graph API | ||
| prior to v2.1. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKNonJSONResponseProperty; |
| @@ -0,0 +1,52 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| /*! | ||
| @abstract A container class for data attachments so that additional metadata can be provided about the attachment. | ||
| */ | ||
| @interface FBSDKGraphRequestDataAttachment : NSObject | ||
|
|
||
| /*! | ||
| @abstract Initializes the receiver with the attachment data and metadata. | ||
| @param data The attachment data (retained, not copied) | ||
| @param filename The filename for the attachment | ||
| @param contentType The content type for the attachment | ||
| */ | ||
| - (instancetype)initWithData:(NSData *)data | ||
| filename:(NSString *)filename | ||
| contentType:(NSString *)contentType | ||
| NS_DESIGNATED_INITIALIZER; | ||
|
|
||
| /*! | ||
| @abstract The content type for the attachment. | ||
| */ | ||
| @property (nonatomic, copy, readonly) NSString *contentType; | ||
|
|
||
| /*! | ||
| @abstract The attachment data. | ||
| */ | ||
| @property (nonatomic, strong, readonly) NSData *data; | ||
|
|
||
| /*! | ||
| @abstract The filename for the attachment. | ||
| */ | ||
| @property (nonatomic, copy, readonly) NSString *filename; | ||
|
|
||
| @end |
| @@ -0,0 +1,39 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #ifdef __cplusplus | ||
| #define FBSDK_EXTERN extern "C" __attribute__((visibility ("default"))) | ||
| #else | ||
| #define FBSDK_EXTERN extern __attribute__((visibility ("default"))) | ||
| #endif | ||
|
|
||
| #define FBSDK_STATIC_INLINE static inline | ||
|
|
||
| #define FBSDK_NO_DESIGNATED_INITIALIZER() \ | ||
| @throw [NSException exceptionWithName:NSInvalidArgumentException \ | ||
| reason:[NSString stringWithFormat:@"unrecognized selector sent to instance %p", self] \ | ||
| userInfo:nil] | ||
|
|
||
| #define FBSDK_NOT_DESIGNATED_INITIALIZER(DESIGNATED_INITIALIZER) \ | ||
| @throw [NSException exceptionWithName:NSInvalidArgumentException \ | ||
| reason:[NSString stringWithFormat:@"Please use the designated initializer [%p %@]", \ | ||
| self, \ | ||
| NSStringFromSelector(@selector(DESIGNATED_INITIALIZER))] \ | ||
| userInfo:nil] |
| @@ -0,0 +1,35 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #import <FBSDKCoreKit/FBSDKCopying.h> | ||
|
|
||
| /*! | ||
| @abstract Extension protocol for NSMutableCopying that adds the mutableCopy method, which is implemented on NSObject. | ||
| @discussion NSObject<NSCopying, NSMutableCopying> implicitly conforms to this protocol. | ||
| */ | ||
| @protocol FBSDKMutableCopying <FBSDKCopying, NSMutableCopying> | ||
|
|
||
| /*! | ||
| @abstract Implemented by NSObject as a convenience to mutableCopyWithZone:. | ||
| @return A mutable copy of the receiver. | ||
| */ | ||
| - (id)mutableCopy; | ||
|
|
||
| @end |
| @@ -0,0 +1,148 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import "FBSDKMacros.h" | ||
| #import "FBSDKProfilePictureView.h" | ||
|
|
||
| /*! | ||
| @abstract Notification indicating that the `currentProfile` has changed. | ||
| @discussion the userInfo dictionary of the notification will contain keys | ||
| `FBSDKProfileChangeOldKey` and | ||
| `FBSDKProfileChangeNewKey`. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKProfileDidChangeNotification; | ||
|
|
||
| /* @abstract key in notification's userInfo object for getting the old profile. | ||
| @discussion If there was no old profile, the key will not be present. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKProfileChangeOldKey; | ||
|
|
||
| /* @abstract key in notification's userInfo object for getting the new profile. | ||
| @discussion If there is no new profile, the key will not be present. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKProfileChangeNewKey; | ||
|
|
||
| /*! | ||
| @abstract Represents an immutable Facebook profile | ||
| @discussion This class provides a global "currentProfile" instance to more easily | ||
| add social context to your application. When the profile changes, a notification is | ||
| posted so that you can update relevant parts of your UI and is persisted to NSUserDefaults. | ||
| Typically, you will want to call `enableUpdatesOnAccessTokenChange:YES` so that | ||
| it automatically observes changes to the `[FBSDKAccessToken currentAccessToken]`. | ||
| You can use this class to build your own `FBSDKProfilePictureView` or in place of typical requests to "/me". | ||
| */ | ||
| @interface FBSDKProfile : NSObject<NSCopying, NSSecureCoding> | ||
|
|
||
| /*! | ||
| @abstract initializes a new instance. | ||
| @param userID the user ID | ||
| @param firstName the user's first name | ||
| @param middleName the user's middle name | ||
| @param lastName the user's last name | ||
| @param name the user's complete name | ||
| @param linkURL the link for this profile | ||
| @param refreshDate the optional date this profile was fetched. Defaults to [NSDate date]. | ||
| */ | ||
| - (instancetype)initWithUserID:(NSString *)userID | ||
| firstName:(NSString *)firstName | ||
| middleName:(NSString *)middleName | ||
| lastName:(NSString *)lastName | ||
| name:(NSString *)name | ||
| linkURL:(NSURL *)linkURL | ||
| refreshDate:(NSDate *)refreshDate NS_DESIGNATED_INITIALIZER; | ||
| /*! | ||
| @abstract The user id | ||
| */ | ||
| @property (nonatomic, readonly) NSString *userID; | ||
| /*! | ||
| @abstract The user's first name | ||
| */ | ||
| @property (nonatomic, readonly) NSString *firstName; | ||
| /*! | ||
| @abstract The user's middle name | ||
| */ | ||
| @property (nonatomic, readonly) NSString *middleName; | ||
| /*! | ||
| @abstract The user's last name | ||
| */ | ||
| @property (nonatomic, readonly) NSString *lastName; | ||
| /*! | ||
| @abstract The user's complete name | ||
| */ | ||
| @property (nonatomic, readonly) NSString *name; | ||
| /*! | ||
| @abstract A URL to the user's profile. | ||
| @discussion Consider using Bolts and `FBSDKAppLinkResolver` to resolve this | ||
| to an app link to link directly to the user's profile in the Facebook app. | ||
| */ | ||
| @property (nonatomic, readonly) NSURL *linkURL; | ||
|
|
||
| /*! | ||
| @abstract The last time the profile data was fetched. | ||
| */ | ||
| @property (nonatomic, readonly) NSDate *refreshDate; | ||
|
|
||
| /*! | ||
| @abstract Gets the current FBSDKProfile instance. | ||
| */ | ||
| + (FBSDKProfile *)currentProfile; | ||
|
|
||
| /*! | ||
| @abstract Sets the current instance and posts the appropriate notification if the profile parameter is different | ||
| than the receiver. | ||
| @param profile the profile to set | ||
| @discussion This persists the profile to NSUserDefaults. | ||
| */ | ||
| + (void)setCurrentProfile:(FBSDKProfile *)profile; | ||
|
|
||
| /*! | ||
| @abstract Indicates if `currentProfile` will automatically observe `FBSDKAccessTokenDidChangeNotification` notifications | ||
| @param enable YES is observing | ||
| @discussion If observing, this class will issue a graph request for public profile data when the current token's userID | ||
| differs from the current profile. You can observe `FBSDKProfileDidChangeNotification` for when the profile is updated. | ||
| Note that if `[FBSDKAccessToken currentAccessToken]` is unset, the `currentProfile` instance remains. It's also possible | ||
| for `currentProfile` to return nil until the data is fetched. | ||
| */ | ||
| + (void)enableUpdatesOnAccessTokenChange:(BOOL)enable; | ||
|
|
||
| /*! | ||
| @abstract A convenience method for returning a complete `NSURL` for retrieving the user's profile image. | ||
| @param mode The picture mode | ||
| @param size The height and width. This will be rounded to integer precision. | ||
| */ | ||
| - (NSURL *)imageURLForPictureMode:(FBSDKProfilePictureMode)mode size:(CGSize)size; | ||
|
|
||
| /*! | ||
| @abstract A convenience method for returning a Graph API path for retrieving the user's profile image. | ||
| @deprecated use `imageURLForPictureMode:size:` instead | ||
| @discussion You can pass this to a `FBSDKGraphRequest` instance to download the image. | ||
| @param mode The picture mode | ||
| @param size The height and width. This will be rounded to integer precision. | ||
| */ | ||
| - (NSString *)imagePathForPictureMode:(FBSDKProfilePictureMode)mode size:(CGSize)size | ||
| __attribute__ ((deprecated("use imageURLForPictureMode:size: instead"))); | ||
|
|
||
| /*! | ||
| @abstract Returns YES if the profile is equivalent to the receiver. | ||
| @param profile the profile to compare to. | ||
| */ | ||
| - (BOOL)isEqualToProfile:(FBSDKProfile *)profile; | ||
| @end |
| @@ -0,0 +1,59 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
|
|
||
| /*! | ||
| @typedef FBSDKProfilePictureMode enum | ||
| @abstract Defines the aspect ratio mode for the source image of the profile picture. | ||
| */ | ||
| typedef NS_ENUM(NSUInteger, FBSDKProfilePictureMode) | ||
| { | ||
| /*! | ||
| @abstract A square cropped version of the image will be included in the view. | ||
| */ | ||
| FBSDKProfilePictureModeSquare, | ||
| /*! | ||
| @abstract The original picture's aspect ratio will be used for the source image in the view. | ||
| */ | ||
| FBSDKProfilePictureModeNormal, | ||
| }; | ||
|
|
||
| /*! | ||
| @abstract A view to display a profile picture. | ||
| */ | ||
| @interface FBSDKProfilePictureView : UIView | ||
|
|
||
| /*! | ||
| @abstract The mode for the receiver to determine the aspect ratio of the source image. | ||
| */ | ||
| @property (nonatomic, assign) FBSDKProfilePictureMode pictureMode; | ||
|
|
||
| /*! | ||
| @abstract The profile ID to show the picture for. | ||
| */ | ||
| @property (nonatomic, copy) NSString *profileID; | ||
|
|
||
| /*! | ||
| @abstract Explicitly marks the receiver as needing to update the image. | ||
| @discussion This method is called whenever any properties that affect the source image are modified, but this can also | ||
| be used to trigger a manual update of the image if it needs to be re-downloaded. | ||
| */ | ||
| - (void)setNeedsImageUpdate; | ||
|
|
||
| @end |
| @@ -0,0 +1,209 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
|
|
||
| #import <FBSDKCoreKit/FBSDKMacros.h> | ||
|
|
||
| /* | ||
| * Constants defining logging behavior. Use with <[FBSDKSettings setLoggingBehavior]>. | ||
| */ | ||
|
|
||
| /*! Include access token in logging. */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorAccessTokens; | ||
|
|
||
| /*! Log performance characteristics */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorPerformanceCharacteristics; | ||
|
|
||
| /*! Log FBSDKAppEvents interactions */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorAppEvents; | ||
|
|
||
| /*! Log Informational occurrences */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorInformational; | ||
|
|
||
| /*! Log cache errors. */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorCacheErrors; | ||
|
|
||
| /*! Log errors from SDK UI controls */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorUIControlErrors; | ||
|
|
||
| /*! Log debug warnings from API response, i.e. when friends fields requested, but user_friends permission isn't granted. */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorGraphAPIDebugWarning; | ||
|
|
||
| /*! Log warnings from API response, i.e. when requested feature will be deprecated in next version of API. | ||
| Info is the lowest level of severity, using it will result in logging all previously mentioned levels. | ||
| */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorGraphAPIDebugInfo; | ||
|
|
||
| /*! Log errors from SDK network requests */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorNetworkRequests; | ||
|
|
||
| /*! Log errors likely to be preventable by the developer. This is in the default set of enabled logging behaviors. */ | ||
| FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorDeveloperErrors; | ||
|
|
||
| @interface FBSDKSettings : NSObject | ||
|
|
||
| /*! | ||
| @abstract Get the Facebook App ID used by the SDK. | ||
| @discussion If not explicitly set, the default will be read from the application's plist (FacebookAppID). | ||
| */ | ||
| + (NSString *)appID; | ||
|
|
||
| /*! | ||
| @abstract Set the Facebook App ID to be used by the SDK. | ||
| @param appID The Facebook App ID to be used by the SDK. | ||
| */ | ||
| + (void)setAppID:(NSString *)appID; | ||
|
|
||
| /*! | ||
| @abstract Get the default url scheme suffix used for sessions. | ||
| @discussion If not explicitly set, the default will be read from the application's plist (FacebookUrlSchemeSuffix). | ||
| */ | ||
| + (NSString *)appURLSchemeSuffix; | ||
|
|
||
| /*! | ||
| @abstract Set the app url scheme suffix used by the SDK. | ||
| @param appURLSchemeSuffix The url scheme suffix to be used by the SDK. | ||
| */ | ||
| + (void)setAppURLSchemeSuffix:(NSString *)appURLSchemeSuffix; | ||
|
|
||
| /*! | ||
| @abstract Retrieve the Client Token that has been set via [FBSDKSettings setClientToken]. | ||
| @discussion If not explicitly set, the default will be read from the application's plist (FacebookClientToken). | ||
| */ | ||
| + (NSString *)clientToken; | ||
|
|
||
| /*! | ||
| @abstract Sets the Client Token for the Facebook App. | ||
| @discussion This is needed for certain API calls when made anonymously, without a user-based access token. | ||
| @param clientToken The Facebook App's "client token", which, for a given appid can be found in the Security | ||
| section of the Advanced tab of the Facebook App settings found at <https://developers.facebook.com/apps/[your-app-id]> | ||
| */ | ||
| + (void)setClientToken:(NSString *)clientToken; | ||
|
|
||
| /*! | ||
| @abstract A convenient way to toggle error recovery for all FBSDKGraphRequest instances created after this is set. | ||
| @param disableGraphErrorRecovery YES or NO. | ||
| */ | ||
| + (void)setGraphErrorRecoveryDisabled:(BOOL)disableGraphErrorRecovery; | ||
|
|
||
| /*! | ||
| @abstract Get the Facebook Display Name used by the SDK. | ||
| @discussion If not explicitly set, the default will be read from the application's plist (FacebookDisplayName). | ||
| */ | ||
| + (NSString *)displayName; | ||
|
|
||
| /*! | ||
| @abstract Set the default Facebook Display Name to be used by the SDK. | ||
| @discussion This should match the Display Name that has been set for the app with the corresponding Facebook App ID, | ||
| in the Facebook App Dashboard. | ||
| @param displayName The Facebook Display Name to be used by the SDK. | ||
| */ | ||
| + (void)setDisplayName:(NSString *)displayName; | ||
|
|
||
| /*! | ||
| @abstract Get the Facebook domain part. | ||
| @discussion If not explicitly set, the default will be read from the application's plist (FacebookDomainPart). | ||
| */ | ||
| + (NSString *)facebookDomainPart; | ||
|
|
||
| /*! | ||
| @abstract Set the subpart of the Facebook domain. | ||
| @discussion This can be used to change the Facebook domain (e.g. @"beta") so that requests will be sent to | ||
| graph.beta.facebook.com | ||
| @param facebookDomainPart The domain part to be inserted into facebook.com. | ||
| */ | ||
| + (void)setFacebookDomainPart:(NSString *)facebookDomainPart; | ||
|
|
||
| /*! | ||
| @abstract The quality of JPEG images sent to Facebook from the SDK. | ||
| @discussion If not explicitly set, the default is 0.9. | ||
| @see [UIImageJPEGRepresentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/#//apple_ref/c/func/UIImageJPEGRepresentation) */ | ||
| + (CGFloat)JPEGCompressionQuality; | ||
|
|
||
| /*! | ||
| @abstract Set the quality of JPEG images sent to Facebook from the SDK. | ||
| @param JPEGCompressionQuality The quality for JPEG images, expressed as a value from 0.0 to 1.0. | ||
| @see [UIImageJPEGRepresentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/#//apple_ref/c/func/UIImageJPEGRepresentation) */ | ||
| + (void)setJPEGCompressionQuality:(CGFloat)JPEGCompressionQuality; | ||
|
|
||
| /*! | ||
| @abstract | ||
| 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. | ||
| */ | ||
| + (BOOL)limitEventAndDataUsage; | ||
|
|
||
| /*! | ||
| @abstract | ||
| 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. | ||
| @param limitEventAndDataUsage The desired value. | ||
| */ | ||
| + (void)setLimitEventAndDataUsage:(BOOL)limitEventAndDataUsage; | ||
|
|
||
| /*! | ||
| @abstract Retrieve the current iOS SDK version. | ||
| */ | ||
| + (NSString *)sdkVersion; | ||
|
|
||
| /*! | ||
| @abstract Retrieve the current Facebook SDK logging behavior. | ||
| */ | ||
| + (NSSet *)loggingBehavior; | ||
|
|
||
| /*! | ||
| @abstract Set the current Facebook SDK logging behavior. This should consist of strings defined as | ||
| constants with FBSDKLoggingBehavior*. | ||
| @param loggingBehavior A set of strings indicating what information should be logged. If nil is provided, the logging | ||
| behavior is reset to the default set of enabled behaviors. Set to an empty set in order to disable all logging. | ||
| @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: | ||
| */ | ||
| + (void)setLoggingBehavior:(NSSet *)loggingBehavior; | ||
|
|
||
| /*! | ||
| @abstract Enable a particular Facebook SDK logging behavior. | ||
| @param loggingBehavior The LoggingBehavior to enable. This should be a string defined as a constant with FBSDKLoggingBehavior*. | ||
| */ | ||
| + (void)enableLoggingBehavior:(NSString *)loggingBehavior; | ||
|
|
||
| /*! | ||
| @abstract Disable a particular Facebook SDK logging behavior. | ||
| @param loggingBehavior The LoggingBehavior to disable. This should be a string defined as a constant with FBSDKLoggingBehavior*. | ||
| */ | ||
| + (void)disableLoggingBehavior:(NSString *)loggingBehavior; | ||
|
|
||
| /*! | ||
| @abstract Set the user defaults key used by legacy token caches. | ||
| @param tokenInformationKeyName the key used by legacy token caches. | ||
| @discussion Use this only if you customized FBSessionTokenCachingStrategy in v3.x of | ||
| the Facebook SDK for iOS. | ||
| */ | ||
| + (void)setLegacyUserDefaultTokenInformationKeyName:(NSString *)tokenInformationKeyName; | ||
|
|
||
| /*! | ||
| @abstract Get the user defaults key used by legacy token caches. | ||
| */ | ||
| + (NSString *)legacyUserDefaultTokenInformationKeyName; | ||
|
|
||
| @end |
| @@ -0,0 +1,102 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| @class FBSDKAccessToken; | ||
|
|
||
| /*! | ||
| @typedef | ||
| @abstract Callback block for returning an array of FBSDKAccessToken instances (and possibly `NSNull` instances); or an error. | ||
| */ | ||
| typedef void (^FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)(NSArray *tokens, NSError *error) ; | ||
|
|
||
| /*! | ||
| @typedef | ||
| @abstract Callback block for removing a test user. | ||
| */ | ||
| typedef void (^FBSDKTestUsersManagerRemoveTestAccountHandler)(NSError *error) ; | ||
|
|
||
|
|
||
| /*! | ||
| @class FBSDKTestUsersManager | ||
| @abstract Provides methods for managing test accounts for testing Facebook integration. | ||
| @discussion Facebook allows developers to create test accounts for testing their applications' | ||
| Facebook integration (see https://developers.facebook.com/docs/test_users/). This class | ||
| simplifies use of these accounts for writing tests. It is not designed for use in | ||
| production application code. | ||
| This class will make Graph API calls on behalf of your app to manage test accounts and requires | ||
| an app id and app secret. You will typically use this class to write unit or integration tests. | ||
| Make sure you NEVER include your app secret in your production app. | ||
| */ | ||
| @interface FBSDKTestUsersManager : NSObject | ||
|
|
||
| /*! | ||
| @abstract construct or return the shared instance | ||
| @param appID the Facebook app id | ||
| @param appSecret the Facebook app secret | ||
| */ | ||
| + (instancetype)sharedInstanceForAppID:(NSString *)appID appSecret:(NSString *)appSecret; | ||
|
|
||
| /*! | ||
| @abstract retrieve FBSDKAccessToken instances for test accounts with the specific permissions. | ||
| @param arraysOfPermissions an array of permissions sets, such as @[ [NSSet setWithObject:@"email"], [NSSet setWithObject:@"user_birthday"]] | ||
| if you needed two test accounts with email and birthday permissions, respectively. You can pass in empty nested sets | ||
| if you need two arbitrary test accounts. For convenience, passing nil is treated as @[ [NSSet set] ] | ||
| for fetching a single test user. | ||
| @param createIfNotFound if YES, new test accounts are created if no test accounts existed that fit the permissions | ||
| requirement | ||
| @param handler the callback to invoke which will return an array of `FBAccessTokenData` instances or an `NSError`. | ||
| If param `createIfNotFound` is NO, the array may contain `[NSNull null]` instances. | ||
| @discussion If you are requesting test accounts with differing number of permissions, try to order | ||
| `arrayOfPermissionsArrays` so that the most number of permissions come first to minimize creation of new | ||
| test accounts. | ||
| */ | ||
| - (void)requestTestAccountTokensWithArraysOfPermissions:(NSArray *)arraysOfPermissions | ||
| createIfNotFound:(BOOL)createIfNotFound | ||
| completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; | ||
|
|
||
| /*! | ||
| @abstract add a test account with the specified permissions | ||
| @param permissions the set of permissions, e.g., [NSSet setWithObjects:@"email", @"user_friends"] | ||
| @param handler the callback handler | ||
| */ | ||
| - (void)addTestAccountWithPermissions:(NSSet *)permissions | ||
| completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; | ||
|
|
||
| /*! | ||
| @abstract remove a test account for the given user id | ||
| @param userId the user id | ||
| @param handler the callback handler | ||
| */ | ||
| - (void)removeTestAccount:(NSString *)userId completionHandler:(FBSDKTestUsersManagerRemoveTestAccountHandler)handler; | ||
|
|
||
| /*! | ||
| @abstract Make two test users friends with each other. | ||
| @param first the token of the first user | ||
| @param second the token of the second user | ||
| @param callback the callback handler | ||
| */ | ||
| - (void)makeFriendsWithFirst:(FBSDKAccessToken *)first second:(FBSDKAccessToken *)second callback:(void (^)(NSError *))callback; | ||
|
|
||
| @end |
| @@ -0,0 +1,55 @@ | ||
| // Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| // | ||
| // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, | ||
| // copy, modify, and distribute this software in source code or binary form for use | ||
| // in connection with the web services and APIs provided by Facebook. | ||
| // | ||
| // As with any software that integrates with the Facebook platform, your use of | ||
| // this software is subject to the Facebook Developer Principles and Policies | ||
| // [http://developers.facebook.com/policy/]. This copyright notice shall be | ||
| // included in all copies or substantial portions of the software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| /*! | ||
| @abstract Class to contain common utility methods. | ||
| */ | ||
| @interface FBSDKUtility : NSObject | ||
|
|
||
| /*! | ||
| @abstract Parses a query string into a dictionary. | ||
| @param queryString The query string value. | ||
| @return A dictionary with the key/value pairs. | ||
| */ | ||
| + (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString; | ||
|
|
||
| /*! | ||
| @abstract Constructs a query string from a dictionary. | ||
| @param dictionary The dictionary with key/value pairs for the query string. | ||
| @param errorRef If an error occurs, upon return contains an NSError object that describes the problem. | ||
| @result Query string representation of the parameters. | ||
| */ | ||
| + (NSString *)queryStringWithDictionary:(NSDictionary *)dictionary error:(NSError *__autoreleasing *)errorRef; | ||
|
|
||
| /*! | ||
| @abstract Decodes a value from an URL. | ||
| @param value The value to decode. | ||
| @result The decoded value. | ||
| */ | ||
| + (NSString *)URLDecode:(NSString *)value; | ||
|
|
||
| /*! | ||
| @abstract Encodes a value for an URL. | ||
| @param value The value to encode. | ||
| @result The encoded value. | ||
| */ | ||
| + (NSString *)URLEncode:(NSString *)value; | ||
|
|
||
| @end |
| @@ -0,0 +1,6 @@ | ||
| framework module FBSDKCoreKit { | ||
| umbrella header "FBSDKCoreKit.h" | ||
|
|
||
| export * | ||
| module * { export * } | ||
| } |