我已经在我的应用程序中集成了 Instagram,我可以登录和注销,但是当我尝试重新登录时,它不再要求提供凭据。它使用相同的旧凭据登录,但是当我从 iPhone 或模拟器的 Safari/设置中删除 cookie 和历史记录时,它只能正常工作,否则无法正常工作
我正在使用的登录过程是
// here i can store accessToken
IGAppDelegate* appDelegate = (IGAppDelegate*)[UIApplication sharedApplication].delegate;
[[NSUserDefaults standardUserDefaults] setObject:appDelegate.instagram.accessToken forKey:@"accessToken"];
[[NSUserDefaults standardUserDefaults] synchronize];
IGListViewController* viewController = [[IGListViewController alloc] init];
[self.navigationController pushViewController:viewController animated:YES];
对于注销,我正在尝试这样:静态 NSString* kDialogBaseURL = @"https://instagram.com/";
NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray* instagramCookies = [cookies cookiesForURL:[NSURL URLWithString:kDialogBaseURL]];
NSLog(@"Cookies %@",cookies);
NSLog(@"Cookies %@",instagramCookies);
for (NSHTTPCookie* cookie in instagramCookies)
{
NSLog(@"cookies is %@",cookie);
[cookies deleteCookie:cookie];
}
NSLog(@"Cookies %@",cookies);