I am having an odd problem that I can't figure out. I am trying to fill a table with values parsed from some file names.
I am trying to fill up a tableView using the standard:
method.
However, I get an error when I return the value depending on how I set the value eblTestname in rowEblTest.eblTestName.
The problem I have is when I set the eblTestName. The TableView loads just fine if I set the eblTestName directly with an arbitrary testString1 I made directly; however, but I have a memory problem is I use testString2 which comes from a custom NSObject, ImageTag, which I use to parse the filename and then pass the values between my different objects.
I think I have a problem with pointers or something but I can't figure it out.
I am trying to fill up a tableView using the standard:
Code:
tableView:(NSTableView *)aTableView
objectValueForTableColumn: (NSTableColumn *) tableColumn
row: (int) row
However, I get an error when I return the value depending on how I set the value eblTestname in rowEblTest.eblTestName.
Code:
-(id) tableView:(NSTableView *)aTableView
objectValueForTableColumn: (NSTableColumn *) tableColumn
row: (int) row
NSLog(@"CALLED - AppDelegate: objectValueForTableColumn");
NSLog(@"FOR: tableColumn = %@", [tableColumn identifier]);
NSString *tableIdentifier = [tableColumn identifier];
NSLog(@"tableIdentifier = %@", tableIdentifier);
//eblTest Table
if (aTableView == tableView_eblTest) {
NSLog(@"Tableview == EBL Test");
NSLog(@"row = %i, ebltTestArray count = %lu",row, [eblTestArray count]);
if (row <= ([eblTestArray count])) {
NSLog(@"passEBLTestArray size check with:");
// create local EBLTest to handle variables
EBLTest *rowEblTest = [eblTestArray objectAtIndex: row];
// This is where I have the error depending on how eblTestName is defined:
NSLog(@"%@", rowEblTest.eblTestName);
return [rowEblTest valueForKey: tableIdentifier];
}
}
The problem I have is when I set the eblTestName. The TableView loads just fine if I set the eblTestName directly with an arbitrary testString1 I made directly; however, but I have a memory problem is I use testString2 which comes from a custom NSObject, ImageTag, which I use to parse the filename and then pass the values between my different objects.
Code:
// initialize EBLTest object
-(id) initWithBlank {
self = [super init];
NSLog(@"CALLED: EBLTest - initWithBlank");
ImageTagging *newImageTag = [[ImageTagging alloc] init]; // Initializes default ImageTag
// testString1 is hard-coded, arbitrary string
NSString *testString1 = [NSString stringWithString: @"EBL-TA1"];
NSLog(@"TESTSTRING = %@", testString1); // This outputs fine
// testString2 is taken from a newImageTag
NSString *testString2 = [newImageTag valueForKey:@"eblTestName"];
NSLog(@"TESTSTRING2 = %@", testString2); // This outputs fine
// testString1 sets eblTestName correctly
// testString2 results in a memory error once eblTestName is called from my AppDelegate
eblTestName = [NSString stringWithString: testString2];
NSLog(@"eblTestName = %@", eblTestName); // This outputs fine
dosage = 680;
sampleGroupArray = [[NSMutableArray alloc] init];
return self;
}
I think I have a problem with pointers or something but I can't figure it out.