Inherits from NSObject
Declared in NMFacebookUtils.h
NMFacebookUtils.m

Overview

NMFacebookUtils class is used to perform user operations with a Facebook account. In order to benefit from this class properly, you should add Facebook SDK into your project and make necessary configurations to be able to access to a Facebook account.

Tasks

  • + facebookAppId

    Returns the FacebookAppID, which is set for the application in order to perform login operations with a Facebook account. If this id is not set, then any login operation regarding Facebook can not be done.

  • + setFacebookAppId:

    Sets the FacebookAppID for the application in order to perform login operations with a Facebook account. If this id is not set, then any login operation regarding Facebook can not be done.

  • + loginWithCompletionHandler:

    Logs on a user with a Facebook account for the registered application without any read permissions. It is not allowed to pass publish permissions to this method.

  • + loginWithFacebookAppId:completionHandler:

    Logs on a user with a Facebook account for the registered application without any read permissions. It is not allowed to pass publish permissions to this method.

  • + loginWithPermissions:completionHandler:

    Logs on a user with a Facebook account for the registered application with the given read permissions. It is not allowed to pass publish permissions to this method. However, if publish permissions are needed, you may use requestNewPublishPermissions:defaultAudience:completionHandler: to specify additional permissions as well as an audience.

  • + loginWithPermissions:facebookAppId:completionHandler:

    Logs on a user with a Facebook account for the registered application with the given read permissions. It is not allowed to pass publish permissions to this method. However, if publish permissions are needed, you may use requestNewPublishPermissions:defaultAudience:completionHandler: to specify additional permissions as well as an audience.

  • + logout

    Logs the user out of the application. This method also closes out the Facebook session in memory and clears out an persisted cache of token data.

Class Methods

facebookAppId

Returns the FacebookAppID, which is set for the application in order to perform login operations with a Facebook account. If this id is not set, then any login operation regarding Facebook can not be done.

+ (NSString *)facebookAppId

Return Value

The FacebookAppID that is set for the application. Returns nil if there is no FacebookAppID.

Discussion

Returns the FacebookAppID, which is set for the application in order to perform login operations with a Facebook account. If this id is not set, then any login operation regarding Facebook can not be done.

Declared In

NMFacebookUtils.h

loginWithCompletionHandler:

Logs on a user with a Facebook account for the registered application without any read permissions. It is not allowed to pass publish permissions to this method.

+ (void)loginWithCompletionHandler:(NMUserResponseHandler)handler

Parameters

handler

The block to execute when login with a Facebook account is completed.

Discussion

Logs on a user with a Facebook account for the registered application without any read permissions. It is not allowed to pass publish permissions to this method.

After you login on the application with a Facebook, a NMUser object associated with the Facebook account is created over cloud automatically. You can access this newly-created user in completion handler. The default login flow sequence that the Facebook SDK implements: 1. iOS Login Dialog (The account credentials in Facebook section in Settings application.) 2. Facebook App Native Login Dialog 3. Facebook App Web Login Dialog 4. Mobile Safari Login Dialog

Declared In

NMFacebookUtils.h

loginWithFacebookAppId:completionHandler:

Logs on a user with a Facebook account for the registered application without any read permissions. It is not allowed to pass publish permissions to this method.

+ (void)loginWithFacebookAppId:(NSString *)appId completionHandler:(NMUserResponseHandler)handler

Parameters

appId

The FacebookAppID that is set for the application.

handler

The block to execute when login with a Facebook account is completed.

Discussion

Logs on a user with a Facebook account for the registered application without any read permissions. It is not allowed to pass publish permissions to this method.

After you login on the application with a Facebook, a NMUser object associated with the Facebook account is created over cloud automatically. You can access this newly-created user in completion handler. The default login flow sequence that the Facebook SDK implements: 1. iOS Login Dialog (The account credentials in Facebook section in Settings application.) 2. Facebook App Native Login Dialog 3. Facebook App Web Login Dialog 4. Mobile Safari Login Dialog

Declared In

NMFacebookUtils.h

loginWithPermissions:completionHandler:

Logs on a user with a Facebook account for the registered application with the given read permissions. It is not allowed to pass publish permissions to this method. However, if publish permissions are needed, you may use requestNewPublishPermissions:defaultAudience:completionHandler: to specify additional permissions as well as an audience.

+ (void)loginWithPermissions:(NSArray *)permissions completionHandler:(NMUserResponseHandler)handler

Parameters

permissions

An array of strings representing the read permissions to request during the authentication flow.

handlerThe

block to execute when login with a Facebook account is completed.

Discussion

Logs on a user with a Facebook account for the registered application with the given read permissions. It is not allowed to pass publish permissions to this method. However, if publish permissions are needed, you may use requestNewPublishPermissions:defaultAudience:completionHandler: to specify additional permissions as well as an audience.

After you login on the application with a Facebook, a NMUser object associated with the Facebook account is created over cloud automatically. You can access this newly-created user in completion handler. The default login flow sequence that the Facebook SDK implements: 1. iOS Login Dialog (The account credentials in Facebook section in Settings application.) 2. Facebook App Native Login Dialog 3. Facebook App Web Login Dialog 4. Mobile Safari Login Dialog

Declared In

NMFacebookUtils.h

loginWithPermissions:facebookAppId:completionHandler:

Logs on a user with a Facebook account for the registered application with the given read permissions. It is not allowed to pass publish permissions to this method. However, if publish permissions are needed, you may use requestNewPublishPermissions:defaultAudience:completionHandler: to specify additional permissions as well as an audience.

+ (void)loginWithPermissions:(NSArray *)permissions facebookAppId:(NSString *)appId completionHandler:(NMUserResponseHandler)block

Parameters

permissions

An array of strings representing the read permissions to request during the authentication flow.

appId

The FacebookAppID that is set for the application.

handler

The block to execute when login with a Facebook account is completed.

Discussion

Logs on a user with a Facebook account for the registered application with the given read permissions. It is not allowed to pass publish permissions to this method. However, if publish permissions are needed, you may use requestNewPublishPermissions:defaultAudience:completionHandler: to specify additional permissions as well as an audience.

After you login on the application with a Facebook, a NMUser object associated with the Facebook account is created over cloud automatically. You can access this newly-created user in completion handler. The default login flow sequence that the Facebook SDK implements: 1. iOS Login Dialog (The account credentials in Facebook section in Settings application.) 2. Facebook App Native Login Dialog 3. Facebook App Web Login Dialog 4. Mobile Safari Login Dialog

Declared In

NMFacebookUtils.h

logout

Logs the user out of the application. This method also closes out the Facebook session in memory and clears out an persisted cache of token data.

+ (void)logout

Discussion

Logs the user out of the application. This method also closes out the Facebook session in memory and clears out an persisted cache of token data.

Declared In

NMFacebookUtils.h

setFacebookAppId:

Sets the FacebookAppID for the application in order to perform login operations with a Facebook account. If this id is not set, then any login operation regarding Facebook can not be done.

+ (void)setFacebookAppId:(NSString *)appId

Parameters

The

NSString representation of the appID obtained from Facebook developer website.

Discussion

Sets the FacebookAppID for the application in order to perform login operations with a Facebook account. If this id is not set, then any login operation regarding Facebook can not be done.

It is recommended to set FacebookAppID with the relevant key-value pair in Info.plist

Declared In

NMFacebookUtils.h