FBSDKProfile
เวอร์ชั่นที่ใหม่กว่าของคลาสนี้พร้อมแล้ว ตรวจสอบได้ เวอร์ชั่นล่าสุด

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".

Conforms to:NSCopying, NSSecureCoding
Superclass:NSObject
Declared in:FBSDKProfile.h
ทรัพย์สิน
firstName

The user's first name

@property (nonatomic, readonly) NSString *firstName;
ให้คำรับรองไว้ใน: FBSDKProfile.h
lastName

The user's last name

@property (nonatomic, readonly) NSString *lastName;
ให้คำรับรองไว้ใน: FBSDKProfile.h
linkURL

A URL to the user's profile.

@property (nonatomic, readonly) NSURL *linkURL;
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.

ให้คำรับรองไว้ใน: FBSDKProfile.h
middleName

The user's middle name

@property (nonatomic, readonly) NSString *middleName;
ให้คำรับรองไว้ใน: FBSDKProfile.h
name

The user's complete name

@property (nonatomic, readonly) NSString *name;
ให้คำรับรองไว้ใน: FBSDKProfile.h
refreshDate

The last time the profile data was fetched.

@property (nonatomic, readonly) NSDate *refreshDate;
ให้คำรับรองไว้ใน: FBSDKProfile.h
userID

The user id

@property (nonatomic, readonly) NSString *userID;
ให้คำรับรองไว้ใน: FBSDKProfile.h
วิธีการคลาส
currentProfile

Gets the current FBSDKProfile instance.

+ (FBSDKProfile *) currentProfile;
ให้คำรับรองไว้ใน: FBSDKProfile.h
enableUpdatesOnAccessTokenChange:

Indicates if currentProfile will automatically observe FBSDKAccessTokenDidChangeNotification notifications

พารามิเตอร์คำอธิบาย
enable

YES is observing

+ (void) enableUpdatesOnAccessTokenChange:(BOOL)enable;
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.

ให้คำรับรองไว้ใน: FBSDKProfile.h
loadCurrentProfileWithCompletion:

Loads the current profile and passes it to the completion block.

พารามิเตอร์คำอธิบาย
completion

The block to be executed once the profile is loaded

+ (void)
loadCurrentProfileWithCompletion
void
^
FBSDKProfile
profile
NSError
error
completion;
Discussion:

If the profile is already loaded, this method will call the completion block synchronously, otherwise it will begin a graph request to update currentProfile and then call the completion block when finished.

ให้คำรับรองไว้ใน: FBSDKProfile.h
setCurrentProfile:

Sets the current instance and posts the appropriate notification if the profile parameter is different than the receiver.

พารามิเตอร์คำอธิบาย
profile

The profile to set

+ (void) setCurrentProfile:(FBSDKProfile *)profile;
Discussion:

This persists the profile to NSUserDefaults.

ให้คำรับรองไว้ใน: FBSDKProfile.h
วิธีการทันใจ
imagePathForPictureMode:size:

A convenience method for returning a Graph API path for retrieving the user's profile image.

พารามิเตอร์คำอธิบาย
mode

The picture mode

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")));
Discussion:

You can pass this to a FBSDKGraphRequest instance to download the image.

ให้คำรับรองไว้ใน: FBSDKProfile.h
imageURLForPictureMode:size:

A convenience method for returning a complete NSURL for retrieving the user's profile image.

พารามิเตอร์คำอธิบาย
mode

The picture mode

size

The height and width. This will be rounded to integer precision.

- (NSURL *)
imageURLForPictureMode: (FBSDKProfilePictureMode)mode
size: (CGSize)size;
ให้คำรับรองไว้ใน: FBSDKProfile.h
initWithUserID:firstName:middleName:lastName:name:linkURL:refreshDate:

Initializes a new instance.

พารามิเตอร์คำอธิบาย
userID

The user ID

firstName

The user's first name

middleName

The user's middle name

lastName

The user's last name

name

The user's complete name

linkURL

The link for this profile

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;
ให้คำรับรองไว้ใน: FBSDKProfile.h
isEqualToProfile:

Returns YES if the profile is equivalent to the receiver.

พารามิเตอร์คำอธิบาย
profile

The profile to compare to.

- (BOOL) isEqualToProfile:(FBSDKProfile *)profile;
ให้คำรับรองไว้ใน: FBSDKProfile.h
คอนสแตนซ์
FBSDKProfileDidChangeNotification
FBSDK_EXTER N NSString *const FBSDKProfileDidChangeNotification;
Discussion:

The userInfo dictionary of the notification will contain keys FBSDKProfileChangeOldKey and FBSDKProfileChangeNewKey.

ให้คำรับรองไว้ใน: FBSDKProfile.h