• 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: Trying to open a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to open a file


  • Subject: Re: Trying to open a file
  • From: Christian Graus <email@hidden>
  • Date: Wed, 18 Feb 2009 18:15:23 +1100

Thanks - I actually ended ip using NSData and dataFromFileContents, and that
seems to be working fine.  I was just going to post to say I'd solved
it......
I will look to see what fileURLWithPath returns tho, b/c the string is the
same as it was the last time I ran this, but last time it worked ( the code
has not changed, so I am mystified )

On Wed, Feb 18, 2009 at 6:00 PM, Ron Fleckner <email@hidden>wrote:

>
> On 18/02/2009, at 5:35 PM, Christian Graus wrote:
>
>  Hi guys
>> So, I've got a file open dialog, and I have this code:
>>
>> NSString * path = @"file://";
>>
>> NSString * p = [open filename];
>>
>> path = [path stringByAppendingString:p ];
>>
>> NSURL * xmlURL = [[NSURL alloc] initWithString:path ];
>>
>> NSXMLDocument *doc = [[NSXMLDocument alloc] initWithContentsOfURL:xmlURL
>> options:0 error:&error];
>>
>>
>> This WAS working fine.  I added the file:// bit to make it work, b/c
>> otherwise, it would not.  It's now failing.  I've tried to just pass p, in
>> case the default path works now, but no matter what I try, p is
>> /Users/christiangraus/whatever, the path to the file, but xmlURL is nil.
>> Any suggestions gratefully accepted.
>>
>>
>> Christian
>> ______________________________________________
>>
>
> Unless you want to keep a reference to xmlURL, why not just use NSURL's
> +fileURLWithPath: and pass it your open panel's filename?  No need to futz
> with stringByAppendingString and @"file://" etc.
>
> HTH,
>
> Ron
>
_______________________________________________

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: Trying to open a file
      • From: Ken Thomases <email@hidden>
References: 
 >Trying to open a file (From: Christian Graus <email@hidden>)
 >Re: Trying to open a file (From: Ron Fleckner <email@hidden>)

  • Prev by Date: Re: Trying to open a file
  • Next by Date: Re: Is there a known bug in NSUrl?
  • Previous by thread: Re: Trying to open a file
  • Next by thread: Re: Trying to open a file
  • Index(es):
    • Date
    • Thread