NSCFType keeps occurring, something is not being released?
Posted
by
user1493543
on Stack Overflow
See other posts from Stack Overflow
or by user1493543
Published on 2012-07-01T20:44:43Z
Indexed on
2012/07/01
21:16 UTC
Read the original article
Hit count: 215
I'm attempting to delete files from the documents directory using a tableview/array combination.
For some reason, my NSString
pointing to the Documents directory path is being converted to a NSCFType
(which after some research, I understand is happening because a variable is not being released). Because of this, the application crashes at the line
NSString *lastPath = [documentsDirectory stringByAppendingPathComponent:temp];
claiming that NSCFType
cannot recognize the method stringByAppendingPathComponent
.
I would appreciate if someone could help me out (I hope I have explained this clearly enough).
- (void) tableView: (UITableView *) tableView
commitEditingStyle: (UITableViewCellEditingStyle) editingStyle
forRowAtIndexPath: (NSIndexPath *) indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSString *temp = [directoryContent objectAtIndex:indexPath.row];
NSLog(temp);
NSString *lastPath = [documentsDirectory stringByAppendingPathComponent:temp];
[[NSFileManager defaultManager] removeItemAtPath:lastPath error:nil];
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
documentsDirectory = [paths objectAtIndex:0];
directoryContent = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDirectory error:nil] retain];
//tableview handling below
}
© Stack Overflow or respective owner