FBSDKAccessToken
يتوفر إصدار أحدث لهذه الفئة. يرجى التحقق أحدث إصدار.

Represents an immutable access token for using Facebook services.

Conforms to:FBSDKCopying, NSSecureCoding
Superclass:NSObject
Declared in:FBSDKAccessToken.h
الخصائص
appID

Returns the app ID.

@property (readonly, copy, nonatomic) NSString *appID;
تم الكشف في: FBSDKAccessToken.h
declinedPermissions

Returns the known declined permissions.

@property (readonly, copy, nonatomic) NSSet *declinedPermissions;
تم الكشف في: FBSDKAccessToken.h
expirationDate

Returns the expiration date.

@property (readonly, copy, nonatomic) NSDate *expirationDate;
تم الكشف في: FBSDKAccessToken.h
permissions

Returns the known granted permissions.

@property (readonly, copy, nonatomic) NSSet *permissions;
تم الكشف في: FBSDKAccessToken.h
refreshDate

Returns the date the token was last refreshed.

@property (readonly, copy, nonatomic) NSDate *refreshDate;
تم الكشف في: FBSDKAccessToken.h
tokenString

Returns the opaque token string.

@property (readonly, copy, nonatomic) NSString *tokenString;
تم الكشف في: FBSDKAccessToken.h
userID

Returns the user ID.

@property (readonly, copy, nonatomic) NSString *userID;
تم الكشف في: FBSDKAccessToken.h
طرق الفئات
currentAccessToken

Returns the "global" access token that represents the currently logged in user.

+ (FBSDKAccessToken *) currentAccessToken;
Discussion:

The currentAccessToken is a convenient representation of the token of the current user and is used by other SDK components (like FBSDKLoginManager).

تم الكشف في: FBSDKAccessToken.h
refreshCurrentAccessToken:

Refresh the current access token's permission state and extend the token's expiration date, if possible.

المعلمةالوصف
completionHandler

An optional callback handler that can surface any errors related to permission refreshing.

+ (void) refreshCurrentAccessToken:(FBSDKGraphRequestHandler)completionHandler;
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.

تم الكشف في: FBSDKAccessToken.h
setCurrentAccessToken:

Sets the "global" access token that represents the currently logged in user.

المعلمةالوصف
token

The access token to set.

+ (void) setCurrentAccessToken:(FBSDKAccessToken *)token;
Discussion:

This will broadcast a notification and save the token to the app keychain.

تم الكشف في: FBSDKAccessToken.h
طرق المثيلات
hasGranted:

Convenience getter to determine if a permission has been granted

المعلمةالوصف
permission

The permission to check.

- (BOOL) hasGranted:(NSString *)permission;
تم الكشف في: FBSDKAccessToken.h
initWithTokenString:permissions:declinedPermissions:appID:userID:expirationDate:refreshDate:

Initializes a new instance.

المعلمةالوصف
tokenString

The opaque token string.

permissions

The granted permissions. Note this is converted to NSSet and is only an NSArray for the convenience of literal syntax.

declinedPermissions

The declined permissions. Note this is converted to NSSet and is only an NSArray for the convenience of literal syntax.

appID

The app ID.

userID

The user ID.

expirationDate

The optional expiration date (defaults to distantFuture).

refreshDate

The optional date the token was last refreshed (defaults to today).

- (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;
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.

تم الكشف في: FBSDKAccessToken.h
isEqualToAccessToken:

Compares the receiver to another FBSDKAccessToken

المعلمةالوصف
token

The other token

- (BOOL) isEqualToAccessToken:(FBSDKAccessToken *)token;
تم الكشف في: FBSDKAccessToken.h
القيم الثابتة
FBSDKAccessTokenDidChangeNotification
FBSDK_EXTER N NSString *const FBSDKAccessTokenDidChangeNotification;
Discussion:

The userInfo dictionary of the notification will contain keys FBSDKAccessTokenChangeOldKey and FBSDKAccessTokenChangeNewKey.

تم الكشف في: FBSDKAccessToken.h
FBSDKAccessTokenDidChangeUserID
FBSDK_EXTER N NSString *const FBSDKAccessTokenDidChangeUserID;
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).

تم الكشف في: FBSDKAccessToken.h