title: Jailbreak detection mechanism not detecting jailbreak device
body: <p>In my app I wanna detect whether the device is Jailbroken or not.  If it is jailbroken, it should not allow user to use the app. I added a function to detect but its not detecting jailbroken devices</p>
  <p>Attaching the code for reference</p>
  <p><em>JailbrokenDetector.swift</em></p>
  <pre><code>func isJailBroked() -&gt; Bool {
      let pathsArray = [&quot;/bin/bash&quot;, &quot;/usr/sbin/sshd&quot;, &quot;/etc/apt&quot;, &quot;/private/var/lib/apt/&quot;, &quot;/Applications/Cydia.app&quot;, &quot;/Library/MobileSubstrate/MobileSubstrate.dylib&quot;, &quot;/Library/SBSettings/Themes/&quot;, &quot;/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist/&quot;, &quot;/private/var/lib/cydia/private/var/mobile/Library/SBSettings/Themes/&quot;, &quot;/var/cache/apt/&quot;, &quot;/var/lib/cydia/&quot;, &quot;/var/log/syslog/&quot;, &quot;/var/tmp/cydia.log/&quot;, &quot;/bin/bash/&quot;, &quot;/bin/sh/&quot;, &quot;/usr/sbin/sshd/&quot;, &quot;/usr/bin/sshd/&quot;, &quot;/usr/libexec/sftp-server/&quot;, &quot;/etc/ssh/sshd_config/&quot;, &quot;/etc/apt/&quot;, &quot;/Applications/Cydia.app/&quot;, &quot;/Applications/WinterBoard.app/&quot;, &quot;/Applications/SBSettings.app/&quot;, &quot;//private/var/lib/cydia/private/var/mobile/Library/SBSettings/Themes/&quot;, &quot;/usr/libexec/ssh-keysign/&quot;, &quot;/Applications/blackra1n.app&quot;, &quot;/Applications/FakeCarrier.app&quot;, &quot;/Applications/Icy.app&quot;, &quot;/Applications/IntelliScreen.app&quot;, &quot;/Applications/MxTube.app&quot;, &quot;/Applications/RockApp.app&quot;, &quot;/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist&quot;, &quot;/Library/MobileSubstrate/DynamicLibraries/Veency.plist&quot;, &quot;/private/var/stash&quot;, &quot;/private/var/tmp/cydia.log&quot;, &quot;/System/Library/LaunchDaemons/com.ikey.bbot.plist&quot;]
      
      for pathString in pathsArray {
          if FileManager.default.fileExists(atPath: pathString) {
              return true
          }
      }
              
      let dummyString = “Testing”
      
      do {
          try dummyString.write(toFile:&quot;/private/JailbreakTest.txt&quot;, atomically:true, encoding:String.Encoding.utf8)
          return true
      } catch {
          return false
      }
  
    if (UIApplication.shared.canOpenURL(URL(string: &quot;cydia://package/com.example.package&quot;)!) || UIApplication.shared.canOpenURL(URL(string: &quot;Cydia://&quot;)!) || UIApplication.shared.canOpenURL(URL(string: &quot;cydia://&quot;)!)) {
          return true
      }
      
      if self.canOpen(path: &quot;/Applications/Cydia.app&quot;) ||
          self.canOpen(path: &quot;/Library/MobileSubstrate/MobileSubstrate.dylib&quot;) ||
          self.canOpen(path: &quot;/bin/bash&quot;) ||
          self.canOpen(path: &quot;/usr/sbin/sshd&quot;) ||
          self.canOpen(path: &quot;/etc/apt&quot;) ||
          self.canOpen(path: &quot;/usr/bin/ssh&quot;) {
          return true
      }
  }
  </code></pre>
  <p><em>In Appdelegate.m (Obj c)</em></p>
  <pre><code>if ([JailbrokenDetector isDeviceJailBroken]) {
      exit(0);
      return NO;
  }
  </code></pre>