After users upgraded iOS16 beta, some users' sandbox database cannot opening. After checking code logic, it is found that the encrypted key of the database has changed after upgraded iOS16. The code logic of the generated key is as follows:
- (NSString *)mtdxSHA256DatabaseBinaryKeyFromnNSString:(NSString *)string
{ NSString *IDFV = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; NSString *clearString = [IDFV stringByAppendingString:string]; const char *cstr = [clearString cStringUsingEncoding:NSUTF8StringEncoding]; NSData data = [NSData dataWithBytes:cstr length:clearString.length]; uint8_t digest[CC_SHA256_DIGEST_LENGTH]; CC_SHA256(data.bytes, (uint32_t)data.length, digest); NSMutableString result = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH * 2]; for(int i = 0; i < CC_SHA256_DIGEST_LENGTH; i++) { [result appendFormat:@"%02x", digest[i]]; } NSString *key = [NSString stringWithFormat:@"x'%@'",[result uppercaseString]]; return [key copy]; }
This method contains identifierForVendor. I wonder if the IDFV has changed after the iOS16 upgrade? Could apple official help to confirm and reply?
Not an official APP Store package, but the bundle ID has not changed