简体   繁体   中英

Can i clear cache of safari from my ios app is there any method or its sandboxed

基本上我的应用使用safari登录到facebook ive,但是注销不是正确的,因此在appdidfinishlaunching和按按钮操作时使用了close和cleartoken会话,但是不知何故该会话仍然存在,并且它不会提示用户再次登录其名称并直接提供访问权限Facebook页面

could you please check these two links below, hope it help

facebook-ios-sdk logout question

Understanding NSHTTPCookieStorage for the iPhone

OLD UPDATE (see new update below): I think the following link may be useful to you, please try and give me a feedback, thanks.

Is it possible to change iOS Safari settings programmatically

NEW UPDATE: //because we cannot clear cace of safari, so this is the idea that may be useful for you. //The concept is -> in your app, you need to create settings page(to check that in iphone's setting, is there any facebook account? if yes you can post image to facebook(you may use uiswitch, when user switch facebook service to turn on, it will check in iphone's settings menu that, is there any facebook account? if yes you can switch on facebook service)). Then you need to create the "share page", in "share page" will check that in your app's setting page, the facebook service is turn on or not?, if yes, then you can share image to facebook, so we can say that in share page will has a code of sharing image to facebook, and in your app's setting page should look similar to the following. So we just let user log in and log out facebook in iphone setting, and we just check user's account from iphone's setting, so you don't have to headache with facebook logout problem anymore :) , in ios 5 there are no facebook in iphone's setting, so you have no choice, I look for the solution from popular app in app store, and I come out with this solution please look the code below, hope it help, actually I already answered your scope of question already, so this is something like extend question, so next time please post a new question, hope it at least guide you to the right path :).

- (void) facebookAuthen 
{
    ACAccountStore *accountStore = [[ACAccountStore alloc] init];
    ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:@"com.apple.facebook"];

    if (accountType == nil) { // ios lower than 6
        if (FBSession.activeSession.isOpen) {
            [appDelegate closeSession];
            NSLog(@"session close");
        } else {
            [appDelegate openSessionWithAllowLoginUI:YES];
            NSLog(@"open session");
        }
    }
    else { // ios 6
        NSDictionary* options = [NSDictionary dictionaryWithObject:@"your facebook id" forKey:ACFacebookAppIdKey];
        [accountStore requestAccessToAccountsWithType:accountType options:options completion:^(BOOL granted, NSError *error) {
            if(granted) { //has an account in iphone's setting
                // do something 
            }
            else {
                // show alert
            }
        }];
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM