检测embedded.mobileprovision是否被篡改:
// 校验值,可通过上一次打包获取
#define PROVISION_HASH @"Mfx1YZk7hZShm/IyV1QLWdogSQM="
static NSDictionary *rootDic=nil;
void checkSignatureMsg()
{
NSString *newPath = [[NSBundle mainBundle] resourcePath];
if (!rootDic) {
rootDic = [[NSDictionary alloc] initWithContentsOfFile:[newPath stringByAppendingString:@"/_CodeSignature/CodeResources"]];
}
NSDictionary *fileDic = [rootDic objectForKey:@"files2"];
NSDictionary *infoDic = [fileDic objectForKey:@"embedded.mobileprovision"];
NSData *tempData = [infoDic objectForKey:@"hash"];
NSString *hashStr = [tempData base64EncodedStringWithOptions:0];
if (![PROVISION_HASH isEqualToString:hashStr]) {
abort();//退出应用
}
}