I have written code to see if a mp3 file is readable using NSFileManager. However, this string keeps throwing the program off. A MEMORY ERROR! Take a look:
Code:
//
// Created by Will Estes on 1/13/10.
// Copyright 2010 Fondu Development. All rights reserved.
//
#import "DRMinizerMACAppDelegate.h"
@implementation DRMinizerMACAppDelegate
@synthesize window,statusLabel,filePath;
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)path
{
filePath = [[NSString alloc]init];
filePath = path;
NSLog(@"%@",filePath);
i = 1;
[statusLabel setStringValue:@"Song Recieved!"];
return YES;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
}
-(IBAction)stripDRM:(id)sender {
NSLog(@"%@", filePath);
if(i ==1) {
i = 0;
[self drmbgone:filePath];
}
}
-(void)drmbgone:(NSString *)fp {
NSLog(@"drmbgone");
if ( [[NSFileManager defaultManager] isReadableFileAtPath:fp] )
NSLog(@"path is readable");
}
@end
You drag a mp3 file to the dock to get the program to receive the path.
When you click the UI button, it sees if its readable. BUT THE FILEPATH STRING IS GETTING ME A MEMORY ERROR.
HERE IS WHAT THE STACK SAYS:
Code:
0x00007fff8689c0b6 <+0150> callq 0x7fff86936b04 <dyld_stub_getpid>
Program receives SIGKILL
Please help!