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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to