Created
November 8, 2015 22:58
-
-
Save Gerjo/22b340bc19703a415999 to your computer and use it in GitHub Desktop.
FBSDKLoginManager creation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface FBLogin : NSObject | |
+(FBSDKLoginManager*) Instance; | |
@end | |
@implementation FBLogin | |
+(FBSDKLoginManager*) Instance { | |
static FBSDKLoginManager* instance = nil; | |
if(instance == nil) | |
instance = [[FBSDKLoginManager alloc] init]; | |
return instance; | |
} | |
@end | |
/// Later in code: | |
FBSDKLoginManager *login = [FBLogin Instance]; | |
[login | |
logInWithReadPermissions: @[@"email", @"user_friends"] | |
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { | |
// Do stuff here. | |
}]; | |
/// And at some point when actually publishing: | |
[[FBLogin Instance] | |
logInWithPublishPermissions: @[@"publish_actions"] | |
fromViewController: nil | |
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { | |
// Do stuff here. | |
}]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment