我在 iPhone 中集成了 Instagram,第一次登录页面显示在我的 iPhone 上,注销后再次登录时比凭据不询问并直接登录。我在注销时也“无”旧凭据,我也在注销时清除了 cookie,但它不起作用。当我从 safari 中删除 cookie 时,它工作正常。如何以编程方式解决它。
注销按钮代码如下
-(void)doLogout
{
IGAppDelegate* appDelegate = (IGAppDelegate*)[UIApplication sharedApplication].delegate;
[cookies deleteCookie:cookie];
// clear cookie
NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray* instagramCookies = [cookies cookiesForURL:[NSURL URLWithString:@"https://instagram.com/"]];
NSLog(@"Array is == %@",instagramCookies);
for (NSHTTPCookie* cookie in instagramCookies)
{
[cookies deleteCookie:cookie];
}
// accessToken set nil
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"accessToken"];
[[NSUserDefaults standardUserDefaults] synchronize];
[self.navigationController popViewControllerAnimated:YES];
}