I have a function in my class:
-(void)receiveFileName:(NSNotification *) notification {
[self dismissViewControllerAnimated:YES completion:nil];
NSString *selectedFileURL = [notification.userInfo valueForKey:@"selectedFile"];
NSString *fileName = [[selectedFileURL lastPathComponent] stringByDeletingPathExtension];
NSData *fileData = [NSData dataWithContentsOfFile:selectedFileURL];
}
It receives a file destination url from a table view controller and i need it to produce a fileName string and an NSData but i did some debugging and it gets caught on the NSData part and gives me this error:
-[NSURL getFileSystemRepresentation:maxLength:]: unrecognized selector sent to instance 0x1f507830
When i print the selectedFileURL i get
2012-08-14 21:58:01.309 Share Me[4546:907] file://localhost/var/mobile/Applications/B87D9131-2E73-4117-9EE8-32EA7E19127D/Documents/mza_9195653795305984944.320x480-75.jpg
And when i print the file name i get:
2012-08-14 21:58:01.309 Share Me[4546:907] mza_9195653795305984944.320x480-75.jpg
I tried using alloc and init but that didn't solve the problem. Any suggestions?