注销iOS SDK时删除facebook数据

时间:2015-05-21 16:18:04

标签: objective-c facebook-ios-sdk

我真的很抱歉我的英语,但我是意大利人。 我有一个视图控制器(C),使Facebook登录,然后传递给标签视图控制器(A)id,userid和电子邮件变量,在该选项卡视图控制器的选项卡中(A)i&# 39;有另一个视图控制器(B),其中包含注销/登录Facebook按钮,我需要当我按下注销时,我的应用程序上存储的每个Facebook变量都被删除,当我再次登录存储时,这就是我尝试的:

#import "login.h"
#import "dashBoardViewController.h"
#import <FacebookSDK/FacebookSDK.h>
#import "gestAccount.h"

@interface login ()

@end

@implementation login

- (void)viewDidLoad {
    [super viewDidLoad];
    self.loginButton.delegate = self;
    self.loginButton.readPermissions = @[@"public_profile", @"email", @"publish_actions",];


     self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];

    self.loginButton.delegate = self;
    self.loginButton.readPermissions = @[@"public_profile", @"email", @"publish_actions",];

    NSString *userid = ((dashBoardViewController*)self.tabBarController).id;
    NSString *username = ((dashBoardViewController*)self.tabBarController).first_name;
    _profilePicture.profileID = ((dashBoardViewController*)self.tabBarController).id;
    _profilePicture.layer.cornerRadius = _profilePicture.frame.size.width / 2;
    _profilePicture.clipsToBounds = YES;
    _profilePicture.layer.borderWidth = 3.0f;
    _profilePicture.layer.borderColor = [UIColor whiteColor].CGColor;
    self.nameLabel.text = username;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
                            user:(id<FBGraphUser>)user {

    NSString *userName = [user first_name];
    NSString *userId = [user id];
    NSString *userEmail = [user objectForKey:@"email"];


    ((dashBoardViewController*)self.tabBarController).first_name = userName;
    ((dashBoardViewController*)self.tabBarController).id = userId;

    dashBoardViewController *dashBoardViewController =     [self.storyboard instantiateViewControllerWithIdentifier:@"dashBoardViewController"];
    dashBoardViewController.first_name = userName;
    dashBoardViewController.id = userId;
    dashBoardViewController.userEmail = userEmail;
}



-(void)loginView:(FBLoginView *)loginView handleError:(NSError *)error{
    NSLog(@"%@", [error localizedDescription]);
}

- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
    self.profilePicture = nil;
    self.nameLabel.text = @"Loggati";
}

- (IBAction)gotoGestaccount:(id)sender {

    NSString *userid = ((dashBoardViewController*)self.tabBarController).id;
    NSString *username = ((dashBoardViewController*)self.tabBarController).first_name;


   gestAccount *gestaccount = [self.storyboard instantiateViewControllerWithIdentifier:@"gestAccount"];
    gestaccount.first_name = username;
    gestaccount.id = userid;
    [self presentModalViewController:gestaccount animated:YES];
}


@end

但它不起作用,它在日志中给我这个错误:

  

警告:尝试出现    谁的观点不在窗口   层次!

0 个答案:

没有答案