iOS8 + Apple的KeychainItemWrapper导致崩溃 [英] iOS8 + Apple's KeychainItemWrapper results in a crash

查看:886
本文介绍了iOS8 + Apple的KeychainItemWrapper导致崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在围绕Apple论坛挖掘这个问题,但无济于事。使用Apple的KeychainItemWrapper(ARCified),尝试将 kSecAttrAccessible 属性设置为除默认值( kSecAttrAccessibleWhenUnlocked )之外的任何内容来自SecItemUpdate的断言失败返回错误。

I've been digging around Apple forums and SO for this issue to no avail. Using Apple's KeychainItemWrapper (ARCified), trying to set the kSecAttrAccessible attribute to anything except the default (kSecAttrAccessibleWhenUnlocked) results in an assertion failure from SecItemUpdate returning an error.

KeychainItemWrapper *wrapper = [[KeyChainItemWrapper alloc] initWithIdentifier:kMyIdentifier accessGroup:nil];
[wrapper setObject:kMyServiceName forKey:(__bridge NSString*)kSecAttrService];
[wrapper setObject:kMyAccountToken forKey:(__bridge NSString*)kSecAttrAccount];
[wrapper setObject:(__bridge NSString*)kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly forKey:(__bridge NSString*)kSecAttrAccessible];

其余的钥匙串更新似乎正常,但最后一行导致:

The rest of our keychain updates seem to be going through fine, but the last line results in:

*** Assertion failure in -[KeychainItemWrapper writeToKeychain], /Users/john.hammerlund/.../KeychainItemWrapper.m:299

断言失败是由于SecItemUpdate()返回-50的状态,这似乎是一般的无效参数错误。

The assertion failure is due to SecItemUpdate() returning a status of -50, which appears to be a generic "invalid parameters" error.

立即设置 kSecAttrAccessible 键没有任何影响,但将其设置为默认 kSecAttrAccessibleWhenUnlocked 缓解问题(但消除了这一点)。 这个其他问题是我发现的唯一附加信息到iOS 8导致KeychainItemWrapper崩溃。在iOS 7/8上使用iOS 7或模拟器构建设备可以消除这个问题;它仅在使用iOS 8的真实设备上闪亮。

Immediately setting the kSecAttrAccessible key has no impact, but setting it to the default kSecAttrAccessibleWhenUnlocked mitigates the issue (but eliminates the point). This other question is the only additional info I've found relating to iOS 8 causing the KeychainItemWrapper to crash. Building to a device with iOS 7 or a simulator on iOS 7/8 eliminates the issue; it's only flaring up on a real device using iOS 8.

更新

以下是查询字典的概述:

Here's a broad overview of the query dictionary:

{
accc =< SecAccessControlRef:0x1687cc70>;
acct = ...;
agrp = ...;
cdat =2014-10-13 22:22:47 +0000;
desc =;
gena = ...;
labl =;
mdat =2014-10-13 22:34:16 +0000;
pdmn = cku; < - kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
svce = ...;
sync = 0;
tomb = 0;
v_Data=<> ;;
}

和attributesToUpdate参数:

and the attributesToUpdate parameter:

{
accc =< SecAccessControlRef:0x1687cc70>;
acct = ...;
agrp = ...;
cdat =2014-10-13 22:22:47 +0000;
desc =;
gena = ...;
labl =;
mdat =2014-10-13 22:34:16 +0000;
pdmn = ak; < - kSecAttrAccessibleWhenUnlocked
svce = ...;
sync = 0;
tomb = 0;
v_Data=<> ;;
}

我已经确认更改其他字段(即kSecAttrService,kSecAttrAccount)对字典中的相应字段,但预期状态为0.。

I've confirmed that changing other fields (i.e. kSecAttrService, kSecAttrAccount) have the same effect on the corresponding fields in the dictionaries, but with an expected status of 0.

推荐答案

我也遇到了确切的问题。给我:

I also had the exact problem. Gave me:

OSStatus错误-50 - 冲突的kSecAccess和kSecAccessControl属性

OSStatus error -50 - conflicting kSecAccess and kSecAccessControl attributes

崩溃给我的所有用户应用程序商店更新后。

Crashed to all my users in the app store just after they updated.

和彼得一样。抓取数据,删除项目并将其作为新项目插入,而不是尝试更新现有项目。

Did the same as Peter. Grabed the data, deleted the item and inserted it as new item instead of trying to update the existing one.

我想这是Apple漏洞。

I guess this is an Apple bug.

我开了一个TSI,但他们还没有联系我。

I opened a TSI but they didn't contact me yet.

根据我的理解,发生在iOS7更新的用户到iOS 8,他们的第一个应用程序是用iOS7的XCode编译的(在iOS 8出来之前),然后在iOS8上更新到用XCode编译到iOS8的新应用程序。

From what i understand, It happens to users updated from iOS7 to iOS 8, where their first app was compiled with XCode for iOS7 (Before iOS 8 was out), and then on iOS8 updated to the new app which was compiled with XCode to iOS8.

这篇关于iOS8 + Apple的KeychainItemWrapper导致崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆