IOS强制退出app

- (IBAction)action_OK:(id)sender {

    if(_setRow ==0)

    {

        [[NSUserDefaults standardUserDefaults] setObject:@"zh-Hans"forKey:@"seetongLanguage"];

    }

    elseif(_setRow ==1)

    {

        [[NSUserDefaults standardUserDefaults] setObject:@"vi"forKey:@"seetongLanguage"];

    }

    elseif(_setRow ==2)

    {

        [[NSUserDefaults standardUserDefaults] setObject:@"en"forKey:@"seetongLanguage"];

    }


    [[UserClient shareUserClient]showSuccessView:@"Successfully modify,Please restart APP"];


    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

        [[UserClient shareUserClient] dismiss];

        [selfexitApplication];//强制退出程序

    });

}

- (void)exitApplication

{

    UIWindow *window = [UIApplication sharedApplication].delegate.window;

    //退出动画

    [UIView animateWithDuration:1.0fanimations:^{

        window.alpha =0;

        window.frame = CGRectMake(0, window.bounds.size.width,0,0);

    } completion:^(BOOLfinished) {

        exit(0);

    }];

    //exit(0);

}

你可能感兴趣的:(IOS强制退出app)