File Reading Problems
File Reading Problems
- Subject: File Reading Problems
- From: Pierce Freeman <email@hidden>
- Date: Tue, 28 Apr 2009 19:19:20 -0700
- Thread-topic: File Reading Problems
Hi everyone.
I have a small problem with readToEndOfFileInBackgroundAndNotify which is
that I can't seem to get it to work right. ;) I am seeding the connection
with the file name, and everything looks right except that I keep getting
<NSConcreteFileHandle: 0x1abfd0> and *** -[NSConcreteFileHandle length]:
unrecognized selector sent to instance 0x1abfd0 when attempting to use it.
My code is as follows.
- (void)awakeFromNib
{
NSFileHandle *remoteConnection = [NSFileHandle
fileHandleForReadingAtPath:@"/Users/user/Desktop/file.plist"];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(readAllTheData:)
name:NSFileHandleReadToEndOfFileCompletionNotification
object:remoteConnection];
[remoteConnection readToEndOfFileInBackgroundAndNotify];
}
- (void)readAllTheData:(NSNotification *)note {
NSString *errors = nil;
NSData *contentsOfDockFile = [note object];
NSLog(@"%@", contentsOfDockFile);
NSDictionary *testing = [NSPropertyListSerialization
propertyListFromData:contentsOfDockFile
mutabilityOption:NSPropertyListImmutable format:nil
errorDescription:&errors];
NSLog(@"%@", testing);
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSFileHandleReadToEndOfFileCompletionNotification object:[note
object]];
[testing release];
}
Thanks for any help.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden