New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception thrown when unarchiveObjectForKey called on ios 8 #52
Comments
At the risk of stating the obvious, you cannot mix the new Lockbox v3 APIs with data stored using pre-v3 APIs. That is to say, if you had stored a string using |
I did not know that I cannot mix it, but I did mix them with the intend on retrieve key value while migrating existing v2 API codes NSString *object = [Lockbox unarchiveObjectForKey:key];
if(!object) {
object = [Lockbox stringForKey:key];
if(object) {
[Lockbox archiveObject:object forKey:key accessibility:kSecAttrAccessibleWhenUnlocked];
}
}
return object; I was relying on the expectation that |
Your use of both the v2 and v3 APIs to first fetch, and then store, a value for a key is correct. What i meant by not mixing was that you cannot store a key using a v2 API and then retrieve it properly using a v3 API. Your migration code, which fetches then stores, is fine. I see what you're saying about catching the error. I'll look into it. |
Hey @granoff, any hints when v 3.0.1 will be available in Cocoapods? |
Hm. Thought it would be by now. The tags are there, the podspec seems right. Investigating... |
Available now. Sorry! |
Thanks a lot! |
Hi,
I have notice that because the use of
[[NSKeyedUnarchiver alloc] initForReadingWithData:data]
,It will throw NSInvalidArgumentException
[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (xxx,xxx,xxx,0x0, 0x0, 0x0, 0x0, 0x0)
This only happens on ios8 ... it won't happen on ios9 ...
but It think it might be safer to catch the exception within
unarchiveObjectForKey
.. so ppl using this library won't have unexpected exception happen to themThanks
The text was updated successfully, but these errors were encountered: