• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
File Reading Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: File Reading Problems
      • From: Ken Thomases <email@hidden>
    • Re: File Reading Problems
      • From: "Stephen J. Butler" <email@hidden>
  • Prev by Date: Re: NSXMLParser and NSDocument
  • Next by Date: Re: File Reading Problems
  • Previous by thread: Re: NSRunLoop vs. NSThread sleep
  • Next by thread: Re: File Reading Problems
  • Index(es):
    • Date
    • Thread