- (void)viewDidLoad
{
delegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
birthdaylist=[[BirthdayList alloc]initWithNibName:@"BirthdayList" bundle:nil];
spinner=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.alpha=1.0;
spinner.center=CGPointMake(130, 150);
[spinner setHidden:YES];
UIButton *PickFriendsButton=[[UIButton alloc]init];
[PickFriendsButton setFrame:(CGRectMake(100, 200, 150, 33))];
[PickFriendsButton setBackgroundImage:[UIImage imageNamed:@"share_bg.png"] forState:UIControlStateNormal];
[PickFriendsButton setTitle:@"Pick Friends" forState:UIControlStateNormal];
[PickFriendsButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[PickFriendsButton.titleLabel setFont:[UIFont fontWithName:@"Politica" size:15]];
[PickFriendsButton addTarget:self action:@selector(PickFriends:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:PickFriendsButton];
[super viewDidLoad];
FBLoginView *loginview = [[FBLoginView alloc] init];
loginview.frame = CGRectOffset(loginview.frame, 5, 5);
loginview.delegate = self;
[self.view addSubview:loginview];
[loginview sizeToFit];
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_birthday",@"friends_hometown",
@"friends_birthday",@"friends_location",@"basic_info",
@"user_location",
@"user_birthday",
@"user_likes",
nil];
loginview.readPermissions = permissions;
}
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView
{
// first get the buttons set for login mode
NSLog(@"success");
if (FBSession.activeSession.isOpen)
{
NSLog(@"TOKEN : %@",[[FBSession activeSession]accessTokenData]);
FBRequest *friendRequest = [FBRequest requestForGraphPath:@"me/friends?fields=name,picture,birthday,location"];
[friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
NSArray *data = [result objectForKey:@"data"];
for (FBGraphObject<FBGraphUser> *friend in data)
{
// NSLog(@"%@",friend);
[delegate.friendsListArray addObject:friend];
NSLog(@"%@:%@:%@", [friend name],[friend birthday],[friend id]);
}
}];
}
if ([delegate.friendsListArray count]!=0)
{
NSUserDefaults * standardDefaults=[NSUserDefaults standardUserDefaults];
[[NSUserDefaults standardUserDefaults] synchronize];
[standardDefaults setObject:delegate.friendsListArray forKey:@"FriendsListArray"];
[standardDefaults setBool:YES forKey:@"logged_in"];
[standardDefaults synchronize];
NSLog(@"%@",[standardDefaults objectForKey:@"FriendsListArray"]);
[self.navigationController pushViewController:birthdaylist animated:YES];
}
}
它无法查看控制器。我不知道。有什么问题?有任何想法请帮助我。感谢您的帮助。