Re: Output of NSHTTPCookieStorage to NSTableView
Re: Output of NSHTTPCookieStorage to NSTableView
- Subject: Re: Output of NSHTTPCookieStorage to NSTableView
- From: "Michael Ash" <email@hidden>
- Date: Sat, 5 Jul 2008 21:46:54 -0400
On Sun, Jun 29, 2008 at 12:46 AM, Chris Purcell <email@hidden> wrote:
> Hello,
> Not sure where my problem is I've tried a few things and no success. I am
> trying to output NSHTTPCookieStorage *cookies array to a table view.
> Whenever I call the objectValueForTableColumn:row method the app errors
> out, but if I leave it out the app launches displaying the correct number of
> rows with nothing in it (as expected since I left out the other method).
>
> Here is the code to get the cookies array:
>
> NSHTTPCookieStorage* sharedCookieStorage = [NSHTTPCookieStorage
> sharedHTTPCookieStorage];
> cookies = [sharedCookieStorage cookies] ;
>
> Here is the code to output the data to the table view:
>
> - (int)numberOfRowsInTableView:(NSTableView *)tableView
> {
> return [cookies count];
> }
Please read over the guide to Cocoa memory management:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html
In particular, if you're going to use the "cookies" array after the
method where you fetch it, you must retain it.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden