Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Alex had a great idea about putting this in a category. Here's what I ended up using:</p> <p>NSHTTPCookieStorage+Info.h</p> <pre class="lang-objectivec prettyprint-override"><code>#import &lt;Foundation/Foundation.h&gt; @interface NSHTTPCookieStorage (Info) + (NSDictionary*) describeCookies; + (NSDictionary *) describeCookie:(NSHTTPCookie *)cookie; @end </code></pre> <p>NSHTTPCookieStorage.m</p> <pre><code>@implementation NSHTTPCookieStorage (Info) + (NSDictionary*) describeCookies { NSMutableDictionary *descriptions = [NSMutableDictionary new]; [[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies] enumerateObjectsUsingBlock:^(NSHTTPCookie* obj, NSUInteger idx, BOOL *stop) { [descriptions setObject:[[self class] describeCookie:obj] forKey:[[obj name] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; }]; NSLog(@"Cookies:\n\n%@", descriptions); return descriptions; } + (NSDictionary *) describeCookie:(NSHTTPCookie *)cookie { return @{@"value" : [[cookie value] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding], @"domain" : [cookie domain] ? [cookie domain] : @"n/a", @"path" : [cookie path] ? [cookie path] : @"n/a", @"expiresDate" : [cookie expiresDate] ? [cookie expiresDate] : @"n/a", @"sessionOnly" : [cookie isSessionOnly] ? @1 : @0, @"secure" : [cookie isSecure] ? @1 : @0, @"comment" : [cookie comment] ? [cookie comment] : @"n/a", @"commentURL" : [cookie commentURL] ? [cookie commentURL] : @"n/a", @"version" : @([cookie version]) }; } @end </code></pre> <p>Makes the output a bit more "JSON-y"...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload