• 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: WebView open URL upon launch of application? (Having issues)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WebView open URL upon launch of application? (Having issues)


  • Subject: Re: WebView open URL upon launch of application? (Having issues)
  • From: Fritz Anderson <email@hidden>
  • Date: Sat, 28 Jul 2012 16:06:32 -0500

First, this is a Cocoa question, not one about the operation of the Xcode integrated development environment.

Second, am I missing something? Aside from where you should be doing this in the view's life cycle, it wouldn't work anyway.

On 28 Jul 2012, at 3:16 PM, Tom Miller <email@hidden> wrote:

- (void)awakeFromNib {
    NSString *resourcesPath = [[NSBundle mainBundle] resourcePath];
This yields a path in the file system (e.g., /Applications/MyApp.app/Contents/Resources).

    NSString *htmlPath = [resourcesPath stringByAppendingString:@"http://www.google.com"];
This yields the concatenation of the file system path and the URL string (e.g., /Applications/MyApp.app/Contents/Resourceshttp://www.google.com).
    [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:htmlPath]]];
}
The URL passed into requestWithURL would be file://localhost/Applications/MyApp.app/Contents/Resourceshttp://www.google.com . That won't work. To experiment, try (written in Mail and not tested):

NSFileManager * fm = [NSFileManager defaultManager];
assert([fm fileExistsAtPath: htmlPath]);

— F



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >WebView open URL upon launch of application? (Having issues) (From: Tom Miller <email@hidden>)

  • Prev by Date: Re: WebView open URL upon launch of application? (Having issues)
  • Next by Date: Re: Xcode 4.4 LLDB doesn't display instance variables? 4.3.3 did
  • Previous by thread: Re: WebView open URL upon launch of application? (Having issues)
  • Next by thread: Boxed expressions
  • Index(es):
    • Date
    • Thread