退出facebook sdk 3.08 [英] Logout facebook sdk 3.08
问题描述
要登录会导致您注销Safari,但不完全注销,并且在我的帐户中进行下一次登录。我已经看到php中的几个选项,但不工作。代码附加
- (void)viewDidLoad
{
[buttonPost setHidden:NO];
FBLoginView * loginview = [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@publish_actions]];
loginview.frame = CGRectOffset(loginview.frame,5,5);
loginview.delegate = self;
[self.view addSubview:loginview];
[loginview sizeToFit];
}
- (IBAction)发布:(UIButton *)发件人{
[FBRequestConnection startForUploadPhoto:self.imageScreen completionHandler:^(FBRequestConnection * connection,id result,NSError * error )
{
[self showAlert:@照片发布结果:结果错误:错误];
}];
}
- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
[self.buttonPost setHidden:YES];
self.labelFirstName.text = nil;
}
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
//首先获取设置为登录模式的按钮
[self。 buttonPost setHidden:NO];
}
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView用户:(id< FBGraphUser>)user {
//这里我们使用FBGraphUser的帮助器属性,从服务器到json响应的first_name和
// id属性;或者我们可以使用
// NSDictionary方法,如objectForKey从我的json对象获取值
self.labelFirstName.text = [NSString stringWithFormat:@Hello%@!,user.first_name];
//设置FBProfilePictureView实例的profileID属性
//使控件获取并显示用户的配置文件图片
self.loggedInUser = user;
- (void)showAlert:(NSString *)消息
结果:(id)结果
错误:(NSError *)错误{
NSString * alertMsg;
NSString * alertTitle;
if(error){
alertMsg = error.localizedDescription;
alertTitle = @Error;
} else {
NSDictionary * resultDict =(NSDictionary *)result;
alertMsg = [NSString stringWithFormat:@Successfully posted,
message,[resultDict valueForKey:@id]];
alertTitle = @成功;
}
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:alertTitle
message:alertMsg
委托:nil
cancelButtonTitle:@OK
otherButtonTitles:nil];
[alertView show];
}
cookie和缓存机制。
不幸的是,我知道让Safari忘记以前登录凭据的唯一方法是清除设备设置中的Cookie和数据。 p>
我没有真正尝试过,但我确信,当您使用FBSession而不是FBLoginView时,也会发生这种情况。
I have a problem with the disconnection of my facebook app is a simple app, upload a photo to facebook. To login brings you do logout safari but not completely log off and the next login it does on my account. I have seen several options in php but not working. code attached
- (void)viewDidLoad
{
[buttonPost setHidden:NO];
FBLoginView *loginview = [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@"publish_actions"]];
loginview.frame = CGRectOffset(loginview.frame, 5, 5);
loginview.delegate = self;
[self.view addSubview:loginview];
[loginview sizeToFit];
}
- (IBAction)Post:(UIButton *)sender{
[FBRequestConnection startForUploadPhoto:self.imageScreen completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
[self showAlert:@"Photo Post" result:result error:error];
}];
}
- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
[self.buttonPost setHidden:YES];
self.labelFirstName.text = nil;
}
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
// first get the buttons set for login mode
[self.buttonPost setHidden:NO];
}
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {
// here we use helper properties of FBGraphUser to dot-through to first_name and
// id properties of the json response from the server; alternatively we could use
// NSDictionary methods such as objectForKey to get values from the my json object
self.labelFirstName.text = [NSString stringWithFormat:@"Hello %@!", user.first_name];
// setting the profileID property of the FBProfilePictureView instance
// causes the control to fetch and display the profile picture for the user
self.loggedInUser = user;
}
- (void)showAlert:(NSString *)message
result:(id)result
error:(NSError *)error {
NSString *alertMsg;
NSString *alertTitle;
if (error) {
alertMsg = error.localizedDescription;
alertTitle = @"Error";
} else {
NSDictionary *resultDict = (NSDictionary *)result;
alertMsg = [NSString stringWithFormat:@"Successfully posted",
message, [resultDict valueForKey:@"id"]];
alertTitle = @"Success";
}
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:alertTitle
message:alertMsg
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
This problem is related to Safari's cookies and cache mechanisms.
Unfortunately the only way I know to get Safari to forget about the previous login credentials is to clear the Cookies and Data in the devices Settings.
I haven't really tried but I am quite sure that this also happens when you use the FBSession as opposed to the FBLoginView.
这篇关于退出facebook sdk 3.08的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!