• 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
Re: Problem with NSData to NSString to NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with NSData to NSString to NSData


  • Subject: Re: Problem with NSData to NSString to NSData
  • From: Joel Norvell <email@hidden>
  • Date: Wed, 29 Oct 2008 13:46:34 -0700 (PDT)

Dear Cocoa-dev People,

First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the problem with my NSData->NSString->NSData approach.

As an alternative, would it be fruitful to use a Directory Wrapper to represent the data as two files; one the metadata and the other the pdf?  Then I could work with the metadata file, but just display the pdf file.

In the "What could go wrong here?" department, would my compound file end up behaving like a directory (or worse)?

Many thanks,
Joel Norvell


On 2008/10/28, at 21:43, Joel Norvell <<email_removed>> wrote:

> Dear Cocoa-dev People,
>
> I have a file with some metadata prepended to a pdf.
>
> I want to strip the metadata off and display the pdf.
>
> I was trying to do this:
>
> - (void) loadFromPath: (NSString *) path
> {
>  NSData *myData = [NSData dataWithContentsOfFile:path];
>
>  NSString *myStr = [[NSString alloc] initWithData:pdfData
>                                      encoding:NSASCIIStringEncoding];
>
>  // I strip off the metadata here, leaving the pdfStr.
>
>  // Nothing I've tried here has worked:
>  NSData * myNewData = [pdfStr dataUsingEncoding: ???];
>
>  // Display the pdf here...
> }
>
> How can I get this to work?
>
> Sincerely,
>
> Joel Norvell
>
>





_______________________________________________

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: Problem with NSData to NSString to NSData
      • From: Marcel Weiher <email@hidden>
    • Re: Problem with NSData to NSString to NSData
      • From: "Michael Ash" <email@hidden>
    • Re: Problem with NSData to NSString to NSData
      • From: Ricky Sharp <email@hidden>
    • Re: Problem with NSData to NSString to NSData
      • From: Graham Cox <email@hidden>
  • Prev by Date: Unhilite a window title bar?
  • Next by Date: Re: Problem with NSData to NSString to NSData
  • Previous by thread: Re: Problem with NSData to NSString to NSData
  • Next by thread: Re: Problem with NSData to NSString to NSData
  • Index(es):
    • Date
    • Thread