打包失敗有很多的原因,而我這個項目沒有任何的錯誤提示,無從下手。還好有備份,備份是可以打包的。
用最笨的方法,一個一個的把新文件覆蓋到舊項目中,終於把問題鎖定在一個md5函數裏,
+(NSString *)md5:(NSString *)str {
const char *cStr = [str UTF8String];//轉換成utf-8
unsigned char result[16];//開闢一個16字節(128位:md5加密出來就是128位/bit)的空間(一個字節=8字位=8個二進制數)
CC_MD5( cStr, strlen(cStr), result);
/*
extern unsigned char *CC_MD5(const void *data, CC_LONG len, unsigned char *md)官方封裝好的加密方法
把cStr字符串轉換成了32位的16進制數列(這個過程不可逆轉) 存儲到了result這個空間中
*/
return [NSString stringWithFormat:
@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
result[0], result[1], result[2], result[3],
result[4], result[5], result[6], result[7],
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15]
];
/*
x表示十六進制,%02X 意思是不足兩位將用0補齊,如果多餘兩位則不影響
NSLog("%02X", 0x888); //888
NSLog("%02X", 0x4); //04
*/
}
//沒有導包的時候,提示如下:
Implicit declaration of function 'CC_MD5' is invalid in C99
#import <CommonCrypto/CommonDigest.h>