This article references http://www.2cto.com/Article/201303/197244.html
Detect Device cracking
Device jailbreak actually means that you have obtained the highest permissions for all files, but almost all jailbreak users have installed cydia to install plug-ins and software, therefore, you can determine whether the device is jailbroken Based on the apt path and cydia. determines whether the app path exists.
/*** Determine whether the device is jailbroken and the method is based on apt and cydia. * return, yes for jailbroken, no for not */-(bool) isjailbroken {/* cydia. APP */nsstring * cydiapath = @ "/applications/cydia. APP "; if ([[nsfilemanager defaultmanager] fileexistsatpath: cydiapath]) {return yes ;} /* apt */nsstring * aptpath = @ "/private/var/lib/APT/"; if ([[nsfilemanager defaultmanager] fileexistsatpath: aptpath]) {return yes ;} return no ;}
Detect application cracking by comparing the genuine IPA file with the cracked IPA file, two main differences are found after the cracking: 1. the SC _info directory is removed and contains two files: (1) appname. sinf is the metadata file (2) appname. supp is the key to decrypt the executable file. itunesmetadata. the plist file is removed, which is used to record the basic information of the app, such as the purchaser's appleid, APP purchase time, device architecture supported by the app, app version, and app identifier.
/*** Determine whether your app is cracked * return, yes for, no for not */-(bool) ispirated {nsstring * bundlepath = [[nsbundle mainbundle] bundlepath];/* SC _info */If (! [[Nsfilemanager defaultmanager] fileexistsatpath: [nsstring stringwithformat: @ "% @/SC _info", bundlepath]) {return yes;}/* itunesmetadata. plist */If ([[nsfilemanager defaultmanager] fileexistsatpath: [nsstring stringwithformat: @ "% @/itunesmetadata. plist ", bundlepath]) {return yes;} return no ;}