代码在64位iOS模拟器上崩溃,但在32位模拟器或64位设备上没有崩溃

时间:2014-06-17 09:33:03

标签: ios 64-bit

我有这段代码:

-(NSMutableDictionary *)getAttributesDictionary:(BOOL)privateKey{
    NSMutableDictionary * query = [[NSMutableDictionary alloc] init];
    CFTypeRef tag = (__bridge CFTypeRef)((privateKey) ? [self privKeyTag] : [self pubKeyTag]);
    NSLog(@"Tag: %@",tag);
    [query setObject:(__bridge id)kSecClassKey forKey:(__bridge id)kSecClass];

    //This is where the crash happens...
    [query setObject:(__bridge id)(tag) forKey:(__bridge id)kSecAttrApplicationTag];

    [query setObject:[NSNumber numberWithBool:YES] forKey:(__bridge id)kSecReturnData];
    return query;
}

在我的iPhone 5S(64位)或32位模拟器上运行时,它运行正常。但是,如果我在64位模拟器上运行它,它会因错误EXC_BAD_ACCESS(代码= EXC_i386_GPFLT)而崩溃。

有人知道为什么吗?

0 个答案:

没有答案