iOS SDK Version

FBSDKLoginButton

@interfaceFBSDKLoginButton
A button that initiates a log in or log out flow upon tapping.
FBSDKLoginButton works with FBSDKProfile.currentProfile to determine what to display, and automatically starts authentication when tapped (i.e., you do not need to manually subscribe action targets).
Like FBSDKLoginManager, you should make sure your app delegate is connected to FBSDKApplicationDelegate in order for the button’s delegate to receive messages.
FBSDKLoginButton has a fixed height of 30 pixels, but you may change the width. initWithFrame:CGRectZero will size the button to its minimum frame.
  • The default audience to use, if publish permissions are requested at login time.

    Declaration

    Objective-C
    @property(nonatomic,assign,unsafe_unretained,readwrite)FBSDKDefaultAudiencedefaultAudience;
    Swift
    vardefaultAudience:DefaultAudience{getset}
  • Gets or sets the delegate.

    Declaration

    Objective-C
    @property(nonatomic,weak,readwrite)id<FBSDKLoginButtonDelegate>_Nullabledelegate;
  • Undocumented

    Declaration

    Objective-C
    @property(nonatomic,copy,readwrite)NSArray<NSString*>*_Nonnullpermissions;
    Swift
    varpermissions:[String]{getset}
  • Gets or sets the desired tooltip behavior.

    Declaration

    Objective-C
    @property(nonatomic,assign,unsafe_unretained,readwrite)FBSDKLoginButtonTooltipBehaviortooltipBehavior;
    Swift
    vartooltipBehavior:FBLoginButton.TooltipBehavior{getset}
  • Gets or sets the desired tooltip color style.

    Declaration

    Objective-C
    @property(nonatomic,assign,unsafe_unretained,readwrite)FBSDKTooltipColorStyletooltipColorStyle;
    Swift
    vartooltipColorStyle:FBTooltipView.ColorStyle{getset}
  • Gets or sets the desired tracking preference to use for login attempts. Defaults to .enabled

    Declaration

    Objective-C
    @property(nonatomic,assign,unsafe_unretained,readwrite)FBSDKLoginTrackingloginTracking;
    Swift
    varloginTracking:LoginTracking{getset}
  • Gets or sets an optional nonce to use for login attempts. A valid nonce must be a non-empty string without whitespace. An invalid nonce will not be set. Instead, default unique nonces will be used for login attempts.

    Declaration

    Objective-C
    @property(nonatomic,copy,readwrite,nullable)NSString*nonce;
    Swift
    varnonce:String?{getset}
  • Gets or sets an optional page id to use for login attempts.

    Declaration

    Objective-C
    @property(nonatomic,copy,readwrite,nullable)NSString*messengerPageId;
    Swift
    varmessengerPageId:String?{getset}
  • Gets or sets the auth_type to use in the login request. Defaults to rerequest.

    Declaration

    Objective-C
    @property(nonatomic,assign,unsafe_unretained,readwrite,nullable)FBSDKLoginAuthTypeauthType;
    Swift
    varauthType:LoginAuthType?{getset}
  • Create a new LoginButton with a given optional frame and read permissions.

    Declaration

    Swift
    convenienceinit(frame:CGRect=.zero,permissions:[Permission]=[.publicProfile])

    Parameters