JozackOverFlow
JozackOverFlow

Reputation: 267

Make app act as a Server

I'm using CocoaHTTPServer, and I'm able to start the server. In my resources folder, I added a file called "index.html", and here is something that made me confused.

Is there any way for me to achieve it?? Thanks in advance.

Upvotes: 0

Views: 266

Answers (1)

deimus
deimus

Reputation: 9865

  1. You can load a resource into a UIWebView like this

    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"www"]];
    [webview loadRequest:[NSURLRequest requestWithURL:url]];
    
  2. For catching the requests of a UIWebView please check UIWebViewDelegate protocol here. You can play around with following method for example webView:shouldStartLoadWithRequest:navigationType:

Upvotes: 1

Related Questions