• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: QuickLiteRow and NSTableView problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QuickLiteRow and NSTableView problems


  • Subject: Re: QuickLiteRow and NSTableView problems
  • From: Tito Ciuro <email@hidden>
  • Date: Fri, 25 Nov 2005 01:54:12 -0500

Michael,

After looking at the code I've noticed a few things:

1) maindb = [QuickLiteDatabase databaseWithFile:path];

This returns an autoreleased object. You don't retain it, so it gets cleared before you try to call [maindb close]. This is why it crashes.

2) Same thing happens with the cursor: cursor = [maindb performQuery:@"SELECT * FROM tasks;"];

Retain it or else you won't be able to access its elements later on.

3) You don't need the init() and dealloc() methods. You're already instantiating the TController via nib. What you need is to implement - (void)applicationWillTerminate:(NSNotification *)aNotification, so that you have a chance to close the database when the app closes.

Regards,

-- Tito

On 24/11/2005, at 20:53, Michael Hanna wrote:

in my data source method, I get a crash at

QuickLiteRow * qrow = [cursor rowAtIndex: rowIndex];

The NSTableView actually draws the 23 rows into the UI, but when rowIndex is 0, I get a crash, with no useful error message. Any thoughts on why? I -alloc -init cursor in the -init method, and release in -dealloc


any ideas would be appreciated.

 Xcode 2.2, OS 10.4.3

Michael

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: (NSTableColumn *)aTableColumn row:(int)rowIndex
{
if(cursor != nil)
{


		NSString* columnName = [aTableColumn identifier];
		id value;

		QuickLiteRow * qrow = [cursor rowAtIndex: rowIndex];

		if ([columnName isEqualToString:@"tasks.datetime"])
		{
			value = [NSDate dateWithString:[qrow stringForColumn:columnName]];
		}
		else
		{
			value = [(NSString *)qrow stringForColumn:columnName];
		}
		if (value == nil)
			value = @"";
		return value;

	}
	else
		return nil;
}

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >QuickLiteRow and NSTableView problems (From: Michael Hanna <email@hidden>)

  • Prev by Date: Re: NSRunLoop, processes and distributed objects
  • Next by Date: Re: Optimizing NSView's drawRect
  • Previous by thread: QuickLiteRow and NSTableView problems
  • Next by thread: [ANN] AMRollOverButton patched class
  • Index(es):
    • Date
    • Thread