Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
429 views
in Technique[技术] by (71.8m points)

iphone - Is there any length limit of string stored in Keychain?

I want to store some userinfo as a string in Keychain on iOS, so is there any length limit of the string in Keychain?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I threw together an iOS app that would do a binary search using this library to interact with the keychain, and determined that the most I could store was an NS(Mutable)String with length 16,777,110. So noticeably less than either the max length of an NSString or the default value of SQLITE_MAX_LENGTH as suggested in other answers.

EDIT: If you're looking to quickly verify this answer, I'd suggest trying to store a String with length 16,777,110 in the keychain, and then trying one with length 16,777,111. If the first one works and the second one doesn't, this answer is correct.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...