使用社交化SDK无法注销Facebook

使用社交化SDK无法注销Facebook

本文介绍了使用社交化SDK无法注销Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我只需要在用户的个人资料上发布一些字符串,那么我使用Socialize SDK来代替Sharekit来在我的应用程序中集成邮件,Twitter和Facebook。



以下是工作流程:



  1. 如果是第一次用户分享,Facebook / twitter登录屏幕弹出


  2. 用户登录认证后,共享成功。


  3. 第二次,Facebook / twitter登录屏幕不会出现身份验证,分享成功。


  4. 如果用户想要注销facebook / twitter,他进入设置面板,点击twitter / facebook按钮注销。



    [日志消失后回到共享时,用户点击twitter,登录屏幕弹出但是当用户点击Facebook时,会出现一个影子盒f或几秒钟并消失,用户已使用以前的帐户登录。 ]



    我如何解决这个问题?


我试过使用

  [SocializeThirdPartyFacebook removeLocalCredentials],还有

[SZFacebookUtils unlink];

我应该怎么去吧



我尝试清除所有的缓存和cookie,但仍然是一样的结果

  NSHTTPCookieStorage * cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage]; 
NSArray * facebookCookies = [cookies cookiesForURL:
[NSURL URLWithString:@http://login.facebook.com]];

for(NSHTTPCookie * cookie in facebookCookies){

NSLog(@In For);
[cookies deleteCookie:cookie];

NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
[defaults removeObjectForKey:kSocializeFacebookAuthAppId];
[defaults removeObjectForKey:kSocializeFacebookAuthLocalAppId];
[defaults removeObjectForKey:kSocializeFacebookStringForAPI];
[defaults removeObjectForKey:kSocializeConsumerKey];
[defaults removeObjectForKey:kSocializeConsumerSecret];


解决方案

我解决了:



1.在Facebook上的应用程序的提前设置中,我启用了本机/桌面应用程序



2.在基本设置中禁用SSO

3.提前添加de-auth回调网址



4.添加以下代码段: p>

  NSHTTPCookie * cookie; 
NSHTTPCookieStorage * storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for(cookie in [storage cookies])
{
NSString * domainName = [cookie domain];
NSRange domainRange = [domainName rangeOfString:@facebook];
if(domainRange.length> 0)
{
[storage deleteCookie:cookie];
}
}


I am using Socialize SDK in lieu of Sharekit to integrate mail, twitter and facebook in my app.

I only need to post some string on the user's profile which is working fine for facebook and twitter.

Following is the workflow:

  1. User clicks on share , selects facebook/twitter.

  2. If it is for the first time user is sharing, facebook/twitter login screen pops up

  3. User Logs in and after authentication, share is successful.

  4. If user shares for the second time, facebook/twitter login screen doesn't popsup for authentication and the share is successful.

  5. If user wants to logout of facebook/twitter, he goes to the settings panel and clicks on twitter / facebook button to logout.

    [When it goes back to share after log gin out, user clicks on twitter , login screen pops up but when user clicks on facebook, a shadow box appears for few seconds and disappears and user is logged in with the previous account. ]

    How would i resolve this issue ?

I have tried using

[SocializeThirdPartyFacebook removeLocalCredentials] and also

[SZFacebookUtils unlink];

how should i go about it

I tried Clearing all the cache and cookies as well but still the same result

 NSHTTPCookieStorage* cookies =   [NSHTTPCookieStorage sharedHTTPCookieStorage];
        NSArray* facebookCookies = [cookies cookiesForURL:
                                    [NSURL URLWithString:@"http://login.facebook.com"]];

        for (NSHTTPCookie* cookie in facebookCookies) {

            NSLog(@"In For");
            [cookies deleteCookie:cookie];

            NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
            [defaults removeObjectForKey:kSocializeFacebookAuthAppId];
            [defaults removeObjectForKey:kSocializeFacebookAuthLocalAppId];
            [defaults removeObjectForKey:kSocializeFacebookStringForAPI];
            [defaults removeObjectForKey:kSocializeConsumerKey];
            [defaults removeObjectForKey:kSocializeConsumerSecret];
解决方案

I solved it:

1.In the advance settings of the app on facebook, i enabled native/desktop app

2.Disabled SSO in basic settings

3.Added de-auth callback url in advance settings

4.Added the following piece of code:

NSHTTPCookie *cookie;
    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [storage cookies])
    {
        NSString* domainName = [cookie domain];
        NSRange domainRange = [domainName rangeOfString:@"facebook"];
        if(domainRange.length > 0)
        {
            [storage deleteCookie:cookie];
        }
    }

这篇关于使用社交化SDK无法注销Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 18:28