今ではずいぶん減ったとは思いますがiPhoneをJailbreakする人たちはまだ一定数存在します。通常のiPhoneで提供されない機能が使えるようになることで、アプリを改造するのに使う人たちもいます。 そうしたJailbreakによる思わぬ被害を防ぐために、アプリ開発者はDTTJailbreakDetectionを組み込んでおくと良さそうです。

DTTJailbreakDetectionの使い方

DTTJailbreakDetectionを組み込むと、Jailbreakしている端末かどうか判断できるようになります。下記はiOS8以降での使い方です。

if ([DTTJailbreakDetection isJailbroken]) {
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"System Requirements"
                                                                             message:@"This app is only supported on unmodified versions of iOS."
                                                                      preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"OK"
                                                           style:UIAlertActionStyleDefault
                                                         handler:^(UIAlertAction *action) {
        // End your app
    }];
    [alertController addAction:cancelAction];
    [self presentViewController:alertController animated:YES completion:nil];
}

このようにしておくことでJailbreakしている端末を弾けるようになります。ゲームなどでチートを可能にしたり、課金せずに特別な機能が使えるようになることもあります。実際に弾けるのかテストが若干面倒な気もしますが、試してみると良いでしょう。

DTTJailbreakDetectionはiOS用のオープンソース・ソフトウェア(MIT License)です。

thii/DTTJailbreakDetection: A jailbreak detection library for iOS