这段代码很奇怪, 输出调试信息显示是自拍,但不是iPhone手机拍的,怎么可能? 我首先就要求是iPhone手机才去判断是否自拍的?
原来是if语句里面又重复定义了一个int tIsIPhone ... 记取教训!
//判断是否前相机
int tIsFrontCamera = 0;
int tIsIPhone = 0;
int tIsApple = 0;
int tIsIPad = 0;
//镜头型号,可以区分是否iphone及前后相机
NSString *tLensModel = [tExifDict objectForKey:@"LensModel"];
//CLog(@"lxdDetectFaceUrlPath, LensModel=%@", tLensModel);
if (![CMXUtils isBlankString:tLensModel]) {
//判断字符串是否包含iPhone
int tIsIPhone = ([tLensModel rangeOfString:@"iPhone"].location != NSNotFound) ? 1 : 0;
//判断字符串是否包含iPad
tIsIPad = ([tLensModel rangeOfString:@"iPad"].location != NSNotFound) ? 1 : 0;
//是苹果机拍的照片吗?
tIsApple = (tIsIPhone + tIsIPad) > 0 ? 1 : 0;
//判断是否前相机自拍
if (1 == tIsApple) {
tIsFrontCamera = ([tLensModel rangeOfString:@" front camera "].location != NSNotFound) ? 1 : 0;
}
}
CLog(@"lxdDetectFaceUrlPath, tIsIPhone=%d, tIsApple=%d, tIsFrontCamera=%d", tIsIPhone, tIsApple, tIsFrontCamera);