MonoTouch SecKeyChain.Add返回-34018而不是可读值

时间:2016-09-21 21:12:40

标签: ios xamarin xamarin.ios keychain ios10

我已将我的模拟器更新到iOS 10,并在重新安装了我的应用程序之后,我正在尝试将信息保存在钥匙串中,现在它已经崩溃了,因为StatusCode -34018 ......

        SecStatusCode returnCode;

        var match = SecKeyChain.QueryAsRecord(query, out returnCode);
        if (match == null)
        {
            var s = new SecRecord(SecKind.GenericPassword)
            {
                Label = DEVICE_IDENTIFIER_LABEL,
                Description = DEVICE_DESCRIPTION,
                ValueData = NSData.FromString(uuid),
                Accessible = SecAccessible.Always
            };

            returnCode = SecKeyChain.Add(s);
        }

returnCode正在返回-34018 ...我不知道这意味着什么并且没有发现它。我在Assembly Browser中找到了相关的代码:

public enum SecStatusCode
{
    Success,
    Unimplemented = -4,
    IO = -36,
    OpWr = -49,
    Param = -50,
    Allocate = -108,
    UserCanceled = -128,
    BadReq = -909,
    InternalComponent = -2070,
    NotAvailable = -25291,
    ReadOnly = -25292,
    AuthFailed = -25293,
    NoSuchKeyChain = -25294,
    InvalidKeyChain = -25295,
    DuplicateKeyChain = -25296,
    DuplicateItem = -25299,
    ItemNotFound = -25300,
    InteractionNotAllowed = -25308,
    Decode = -26275,
    VerifyFailed = -67808
}

0 个答案:

没有答案