osx - How can I display a website (e.g. apple) in a cocoa app using WebKit? -


OK, so far I've coded the whole thing following the responses of other people, but when I I create and run the website or HTML files specified in the code I do not display on the screen; No more than a white screen is displayed.

It is that I have done so on my header file:

  // My header file (.h): #import & lt; Cocoa / Cocoa H & gt; #important & lt; WebKit / WebKit.h> @interface project_exealelegate: NSBKed & lt; NSApplicationDelegate & gt; {NSWindow * window; IBotlet webview * webview; } @ Property (assign) IBOutlet NSWindow * window; @protecti (nontomic, retten) IBotlet webview * webview; @end   

Implementation:

  // My receipt file (.m): #import "Project_XAppDelegate.h" #import "WebKit / WebKit.h "@Explementation Project_XAppDelegate @ synthesis window; @Sub-synthesize webview; - (zero) applicationDefinitional launching: (NSNetification *) A notification {} - (zero) Jagracombinb {NSSTING * Resources path = [[NSBindel Mainbundle] resourcepath]; NSString * htmlpath = [resourcesPath stringByAppendingString: @ "/ user / ***** / desktop / project x / html / mehmar.html"]; [[WebWaveFream] LoaderQuest: [NSRR request request with url: [NSU file file path: HPP]]]; } @end    

Your html page looks wrong for me OSX Not very familiar, but once you get the bundle path, you should not attach "index.html" to the disk instead of the full path of your file on the disk.

Try [ResourcesPath stringByAppendingString: @ "index.html"] ?

Comments