How do I detect that an iOS app is running on a jailbroken phone?

后端 未结 17 1507
情书的邮戳
情书的邮戳 2020-11-22 10:48

If I want my app to behave differently on a jailbroken iPhone, how would I go about determining this?

17条回答
  •  庸人自扰
    2020-11-22 11:24

    +(BOOL)isJailbroken {
        NSURL* url = [NSURL URLWithString:@"cydia://package/com.example.package"];
        return [[UIApplication sharedApplication] canOpenURL:url];
    }
    

    Checking the file path /Applications/Cydia.app is not allowed on a normal phone? I've never heard of Apple detecting this and rejecting an app for it, but Apple is unpredictable. Cydia has a URL scheme cydia:// which can be legally checked with UIApplication canOpenURL:

提交回复
热议问题