Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 9 changes for latest 3.x(old) version. #1186

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#import "FBAccessTokenData.h"
#import "FBAppLinkData.h"
Expand Down Expand Up @@ -225,7 +226,6 @@ typedef void (^FBAppLinkFallbackHandler)(NSError *error);
}
*/
+ (void)openDeferredAppLink:(FBAppLinkFallbackHandler)fallbackHandler;

@end


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
multiple App Links in a single call.

@discussion
Usage of this type requires a client token. See `[FBSettings setClientToken:]`.
Usage of this type requires a client token and linking
Bolts.framework. See `[FBSettings setClientToken:]`.
*/
@interface FBAppLinkResolver : NSObject<BFAppLinkResolving>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ typedef NS_ENUM(NSInteger, FBErrorCode) {
Reserved for future use.
*/
FBErrorOperationDisallowedForRestrictedTreatment,

/*!
The server returned a response that the SDK could not decode.
*/
FBErrorUnexpectedResponse,
};

/*!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,24 @@ typedef NSUInteger FBRequestState __attribute__((deprecated));
*/
+ (FBRequest *)requestForUploadPhoto:(UIImage *)photo;

/*!

@method

@abstract
Creates a request representing a Graph API call to upload a video to the app's album using the active session.

@discussion
Simplifies preparing a request to post a video.

This method does not initialize an <FBRequestConnection> object. To initiate the API
call first instantiate an <FBRequestConnection> object, add the request to this object,
then call the `start` method on the connection instance.

@param filePath A `NSString` for the video file to upload.
*/
+ (FBRequest *)requestForUploadVideo:(NSString *)filePath;

/*!
@method

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

See FBError.h and FBErrorUtility.h for error category and user message details.
*/
typedef NS_ENUM(NSUInteger, FBRequestConnectionErrorBehavior) {
typedef NS_OPTIONS(NSUInteger, FBRequestConnectionErrorBehavior) {
/*! The default behavior of none */
FBRequestConnectionErrorBehaviorNone = 0,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#import <Accounts/Accounts.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#import "FBSDKMacros.h"

Expand Down Expand Up @@ -101,12 +102,11 @@ typedef NS_ENUM(NSUInteger, FBSessionState) {
by the application.

The `FBSessionLoginBehavior` enum specifies whether to allow fallback, disallow fallback, or
force fallback login behavior. Most applications will use the default, which attempts a normal
Facebook Login, and only falls back if needed. In rare cases, it may be preferable to disallow
fallback Facebook Login completely, or to force a fallback login.
force fallback login behavior. The SDK will determine the best behavior based on the current
device (such as iOS version).
*/
typedef NS_ENUM(NSUInteger, FBSessionLoginBehavior) {
/*! Attempt Facebook Login, ask user for credentials if necessary */
/*! Attempt Facebook Login, ask user for credentials if necessary. This is the default behavior*/
FBSessionLoginBehaviorWithFallbackToWebView = 0,
/*! Attempt Facebook Login, no direct request for credentials will be made */
FBSessionLoginBehaviorWithNoFallbackToWebView = 1,
Expand Down Expand Up @@ -370,6 +370,12 @@ __attribute__((deprecated));
*/
@property (readonly, copy) NSArray *declinedPermissions;

/*!
@abstract The presenting view controller passed to the `open...` methods
@discussion You can use this property to clear out weak references when they are no longer needed.
*/
@property (nonatomic, assign) UIViewController *fromViewController;

/*!
@methodgroup Instance methods
*/
Expand All @@ -392,8 +398,18 @@ __attribute__((deprecated));
state changes. The block will be released when the session is closed.

@param handler A block to call with the state changes. The default is nil.

@param fromViewController The view controller to present from. If nil, the topmost view controller will be
automatically determined as best as possible.
*/
- (void)openWithCompletionHandler:(FBSessionStateHandler)handler;
- (void)openWithCompletionHandler:(FBSessionStateHandler)handler fromViewController:(UIViewController *)fromViewController;

/*!
@deprecated use openWithCompletionHandler:fromViewController: instead
*/
- (void)openWithCompletionHandler:(FBSessionStateHandler)handler
__attribute__ ((deprecated("use openWithCompletionHandler:fromViewController: instead")));


/*!
@method
Expand All @@ -414,11 +430,21 @@ __attribute__((deprecated));

@param behavior Controls whether to allow, force, or prohibit Facebook Login or Inline Facebook Login. The default
is to allow Facebook Login, with fallback to Inline Facebook Login.
@param fromViewController The view controller to present from. If nil, the topmost view controller will be
automatically determined as best as possible.
@param handler A block to call with session state changes. The default is nil.
*/
- (void)openWithBehavior:(FBSessionLoginBehavior)behavior
fromViewController:(UIViewController *)fromViewController
completionHandler:(FBSessionStateHandler)handler;

/*!
@deprecated use openWithBehavior:fromViewControllercompletionHandler instead
*/
- (void)openWithBehavior:(FBSessionLoginBehavior)behavior
completionHandler:(FBSessionStateHandler)handler
__attribute__ ((deprecated("use openWithBehavior:fromViewControllercompletionHandler: instead")));

/*!
@method

Expand Down Expand Up @@ -555,10 +581,12 @@ __attribute__((deprecated));
[UIApplicationDelegate application:openURL:sourceApplication:annotation:]. It should be invoked during
the Facebook Login flow and will update the session information based on the incoming URL.

@deprecated use `[FBAppCall handleOpenURL:sourceApplication:]` or its overloads instead.

@param url The URL as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:].
*/
- (BOOL)handleOpenURL:(NSURL *)url;

- (BOOL)handleOpenURL:(NSURL *)url
__attribute__((deprecated("use [FBAppCall handleOpenURL:sourceApplication:] or its overloads instead")));
/*!
@abstract
A helper method that is used to provide an implementation for
Expand Down Expand Up @@ -612,6 +640,9 @@ __attribute__((deprecated));
token can be used to open the session. Passing NO to this argument, assures the method will not present UI
to the user in order to open the session.

@param fromViewController The view controller to present from. If nil, the topmost view controller will be
automatically determined as best as possible.

@discussion
Returns YES if the session was opened synchronously without presenting UI to the user. This occurs
when there is a cached token available from a previous run of the application. If NO is returned, this indicates
Expand All @@ -620,7 +651,13 @@ __attribute__((deprecated));
this return value is to switch-on facebook capabilities in your UX upon startup, in the case where the session
is opened via cache.
*/
+ (BOOL)openActiveSessionWithAllowLoginUI:(BOOL)allowLoginUI;
+ (BOOL)openActiveSessionWithAllowLoginUI:(BOOL)allowLoginUI fromViewController:(UIViewController *)fromViewController;

/*!
@deprecated use openActiveSessionWithAllowLoginUI:fromViewController: instead
*/
+ (BOOL)openActiveSessionWithAllowLoginUI:(BOOL)allowLoginUI
__attribute__ ((deprecated("use openActiveSessionWithAllowLoginUI:fromViewController: instead")));

/*!
@abstract
Expand Down Expand Up @@ -677,6 +714,9 @@ __attribute__((deprecated));
token can be used to open the session. Passing NO to this argument, assures the method will not present UI
to the user in order to open the session.

@param fromViewController The view controller to present from. If nil, the topmost view controller will be
automatically determined as best as possible.

@param handler Many applications will benefit from notification when a session becomes invalid
or undergoes other state transitions. If a block is provided, the FBSession
object will call the block each time the session changes state.
Expand All @@ -692,8 +732,17 @@ __attribute__((deprecated));
*/
+ (BOOL)openActiveSessionWithReadPermissions:(NSArray *)readPermissions
allowLoginUI:(BOOL)allowLoginUI
fromViewController:(UIViewController *)fromViewController
completionHandler:(FBSessionStateHandler)handler;

/*!
@deprecated use openActiveSessionWithReadPermissions:allowLoginUI:fromViewController:completionHandler: instead
*/
+ (BOOL)openActiveSessionWithReadPermissions:(NSArray *)readPermissions
allowLoginUI:(BOOL)allowLoginUI
completionHandler:(FBSessionStateHandler)handler
__attribute__ ((deprecated("use openActiveSessionWithReadPermissions:allowLoginUI:fromViewController:completionHandler: instead")));

/*!
@abstract
This is a simple method for opening a session with Facebook. Using sessionOpen logs on a user,
Expand All @@ -712,6 +761,9 @@ __attribute__((deprecated));
token can be used to open the session. Passing NO to this argument, assures the method will not present UI
to the user in order to open the session.

@param fromViewController The view controller to present from. If nil, the topmost view controller will be
automatically determined as best as possible.

@param handler Many applications will benefit from notification when a session becomes invalid
or undergoes other state transitions. If a block is provided, the FBSession
object will call the block each time the session changes state.
Expand All @@ -728,8 +780,18 @@ __attribute__((deprecated));
+ (BOOL)openActiveSessionWithPublishPermissions:(NSArray *)publishPermissions
defaultAudience:(FBSessionDefaultAudience)defaultAudience
allowLoginUI:(BOOL)allowLoginUI
fromViewController:(UIViewController *)fromViewController
completionHandler:(FBSessionStateHandler)handler;

/*!
@deprecated use openActiveSessionWithPublishPermissions:defaultAudience:allowLoginUI:fromViewController:completionHandler instead
*/
+ (BOOL)openActiveSessionWithPublishPermissions:(NSArray *)publishPermissions
defaultAudience:(FBSessionDefaultAudience)defaultAudience
allowLoginUI:(BOOL)allowLoginUI
completionHandler:(FBSessionStateHandler)handler
__attribute__ ((deprecated("use openActiveSessionWithPublishPermissions:defaultAudience:allowLoginUI:fromViewController:completionHandler: instead")));

/*!
@abstract
An application may get or set the current active session. Certain high-level components in the SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,25 +296,13 @@ typedef NS_ENUM(NSUInteger, FBRestrictedTreatment) {
+ (void)setLimitEventAndDataUsage:(BOOL)limitEventAndDataUsage;

/*!
@method

@abstract Returns YES if the legacy Graph API mode is enabled
@deprecated legacy Graph API 1.0 has been deprecated. This will always return NO.
*/
+ (BOOL)isPlatformCompatibilityEnabled;
+ (BOOL)isPlatformCompatibilityEnabled __attribute__ ((deprecated("legacy Graph API 1.0 has been deprecated. This will always return NO.")));

/*!
@method

@abstract Configures the SDK to use the legacy platform.

@param enable indicates whether to use the legacy mode

@discussion Setting this flag has several effects:
- FBRequests will target v1.0 of the Graph API.
- Login will use the prior behavior without abilities to decline permission.
- Specific new features such as `FBLikeButton` that require the current platform
will not work.
@deprecated legacy Graph API 1.0 has been deprecated. This will be a no-op.
*/
+ (void)enablePlatformCompatibility:(BOOL)enable;
+ (void)enablePlatformCompatibility:(BOOL)enable __attribute__ ((deprecated("legacy Graph API 1.0 has been deprecated. This will be a no-op.")));

@end
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ FBSDK_EXTERN NSString *kThirdTestUserTag;
/*!
@class FBTestSession

@abstract
Implements an FBSession subclass that knows about test users for a particular
application. This should never be used from a real application, but may be useful
for writing unit tests, etc.
@abstract Deprecated in favor of `FBTestUserSession`
and `FBTestUsersManager`

@discussion
Facebook allows developers to create test accounts for testing their applications'
Expand All @@ -67,6 +65,7 @@ FBSDK_EXTERN NSString *kThirdTestUserTag;
seems to be in an invalid state, it can be deleted manually via the Web interface at
https://developers.facebook.com/apps/APP_ID/permissions?role=test+users.
*/
__attribute__ ((deprecated("use FBTestUsersManager and FBTestUserSession instead")))
@interface FBTestSession : FBSession

/// The app access token (composed of app ID and secret) to use for accessing test users.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2010-present Facebook.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import "FBAccessTokenData.h"
#import "FBSession.h"

/*!
@class FBTestUserSession
@abstract a "headless" (no UI) `FBSession` subclass that requires a token and is used for testing.

@discussion This will generally be used with `FBTestUsersManager` to help exercise
integration tests with Facebook. Use the class method `sessionWithAccessTokenData:` to construct
instances.

Note the supplied token data is not read until the session instance is "opened" (i.e., it will
never be in a "TokenLoaded" state) and uses
`[FBSessionTokenCachingStrategy nullCacheInstance]`.

Furthermore, reauthorization calls will succeed as a no-op (no new permissions added). You may toggle
the `treatReauthorizeAsCancellation` property to get cancellation treatment.
*/
@interface FBTestUserSession : FBSession

/*!
@abstract returns an instance
@discussion This should be used in place of any init methods.
*/
+ (instancetype)sessionWithAccessTokenData:(FBAccessTokenData *)tokenData;

/*!
@abstract Flag to treat reauthorize calls as cancelled.
@discussion
Defaults to NO. If set to YES, reauthorize calls will receive a nil token
as if the user had cancelled the reauthorize.
*/
@property (nonatomic, assign) BOOL treatReauthorizeAsCancellation;

/*!
@abstract Flag to force extending a token expiration at the next opportunity.
*/
@property (nonatomic, assign) BOOL forceAccessTokenExtension;
@end