objective c - NSTableView with source, leads to EXC_BAD_ACCESS -
although find myself familiar bunch of programming languages, fail time used cocoa/objective-c.
i wanted fill nstableview content, next code:
- (int) numberofrowsintableview:(nstableview *)atableview { homecoming (int)[settingsplist count];} - (id) tableview:(nstableview *)atableview objectvaluefortablecolumn:(nstablecolumn *)atablecolumn row:(int)rowindex { nsstring *title = [[nsstring stringwithstring:[[atablecolumn headercell] stringvalue]] autorelease]; nslog(title); // debug nslog(@"%i",rowindex); // debug if([title isequal: @"plugin name"]) { homecoming [[settingsplist objectforkey:[nsstring stringwithformat:@"%i",rowindex]] objectforkey:@"name"]; } else { homecoming @"(n/a)"; } }
settingsplist filled contents of plist, looks this:
<plist version="1.0"> <dict> <key>0</key> <dict> <key>name</key> <string>test-plugin</string> <key>version</key> <string>0.1</string> <key>type</key> <string>car</string> <key>creator</key> <string>icke</string> <key>checksum</key> <string>0x32</string> <key>link</key> <string>http://</string> </dict> </dict>
the problem: works fine 1 row (you can tell looking @ console output, thrown nslog(title);
, nslog(rowindex);
), however, after that, debugger halts execution, throwing exc_bad_access. know means, don't know why i'm getting , how prepare this.
thanks help. :)
you did on release here,
nsstring *title = [[nsstring stringwithstring:[[atablecolumn headercell] stringvalue]] autorelease];
-[nsstring stringwithstring:]
autorelease returned value, didn't need phone call again.
objective-c cocoa plist exc-bad-access nstableview
No comments:
Post a Comment