मैं एक कीचेन आइटम के गुण प्राप्त करने की कोशिश कर रहा हूं। इस कोड को सभी उपलब्ध विशेषताओं को देखना चाहिए, फिर उनके टैग और सामग्री को प्रिंट करना चाहिए।कीचेन आइटम के गुण प्राप्त करना
the docs के अनुसार मुझे 'cdat' जैसे टैग देखना चाहिए, लेकिन इसके बजाय वे सिर्फ एक इंडेक्स की तरह दिखते हैं (यानी, पहला टैग 0 है, अगला 1 है)। इससे यह बहुत बेकार हो जाता है क्योंकि मैं यह नहीं बता सकता कि मैं कौन सा विशेषता ढूंढ रहा हूं।
SecItemClass itemClass;
SecKeychainItemCopyAttributesAndData(itemRef, NULL, &itemClass, NULL, NULL, NULL);
SecKeychainRef keychainRef;
SecKeychainItemCopyKeychain(itemRef, &keychainRef);
SecKeychainAttributeInfo *attrInfo;
SecKeychainAttributeInfoForItemID(keychainRef, itemClass, &attrInfo);
SecKeychainAttributeList *attributes;
SecKeychainItemCopyAttributesAndData(itemRef, attrInfo, NULL, &attributes, 0, NULL);
for (int i = 0; i < attributes->count; i ++)
{
SecKeychainAttribute attr = attributes->attr[i];
NSLog(@"%08x %@", attr.tag, [NSData dataWithBytes:attr.data length:attr.length]);
}
SecKeychainFreeAttributeInfo(attrInfo);
SecKeychainItemFreeAttributesAndData(attributes, NULL);
CFRelease(itemRef);
CFRelease(keychainRef);
जेनेरिक आइटम कक्षाओं को संभालने के तरीके के बारे में बताने के लिए धन्यवाद। 'SecKeychainAttributeInfoForItemID' के लिए प्रलेखन वांछित होने के लिए बहुत कुछ छोड़ देता है। –