DumpCacheViewController.m
1 // 2 // DumpCacheViewController.m 3 // GSSTestApp 4 // 5 // Created by Love Hörnquist Åstrand on 2014-09-03. 6 // Copyright (c) 2014 Apple, Inc. All rights reserved. 7 // 8 9 #import "DumpCacheViewController.h" 10 #include <Heimdal/heimcred.h> 11 12 @interface DumpCacheViewController () 13 14 @end 15 16 @implementation DumpCacheViewController 17 18 - (void)viewDidLoad { 19 [super viewDidLoad]; 20 // Do any additional setup after loading the view. 21 [self dumpCredentials:(id)self]; 22 } 23 24 - (IBAction)dumpCredentials:(id)sender { 25 26 CFDictionaryRef status = HeimCredCopyStatus(NULL); 27 if (status) { 28 CFDataRef data = CFPropertyListCreateData(NULL, status, kCFPropertyListXMLFormat_v1_0, 0, NULL); 29 CFRelease(status); 30 if (data == NULL) { 31 [self.dumpCacheTextView setText:@"failed to convert dictionary to a plist"]; 32 } 33 NSString *string = [[NSString alloc] initWithData:(__bridge NSData *)data encoding:NSUTF8StringEncoding]; 34 35 [self.dumpCacheTextView setText:string]; 36 CFRelease(data); 37 } else { 38 [self.dumpCacheTextView setText:@"no credentials to dump\n"]; 39 } 40 } 41 42 @end