-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewController.m
More file actions
56 lines (41 loc) · 1.33 KB
/
ViewController.m
File metadata and controls
56 lines (41 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// ViewController.m
// UInfo
//
// Created by Arjun Nijhawan on 3/12/17.
// Copyright © 2017 Arjun Nijhawan. All rights reserved.
//
#import "ViewController.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
@interface ViewController () <FBSDKLoginButtonDelegate>
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//create a login button
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
// Optional: Place the button in the center of your view.
loginButton.center = self.view.center;
[loginButton setDelegate:self];
[self.view addSubview:loginButton];
if([FBSDKAccessToken currentAccessToken] != nil) {
[self performSegueWithIdentifier: @"toTable" sender: nil];
}
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)
loginButton: (FBSDKLoginButton *)loginButton
didCompleteWithResult: (FBSDKLoginManagerLoginResult *)result
error: (NSError *)error {
// NSLog(@"lol");
[self performSegueWithIdentifier: @"toTable" sender: nil];
}
-(void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton {
NSLog(@"You are now logged out.");
}
@end