UIWebView
에 로컬 웹 페이지를 표시하려고합니다. 로컬 웹 페이지는 PHP
파일이며 Supporting Files 폴더에 저장되고 웹 페이지라고하는 폴더에 저장됩니다. 이 코드를 시도했지만 작동하지 않습니다. PHP
요구에 서버가 실행되기 때문에UIWebView에서 로컬 웹 페이지 표시
@synthesize web;
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"php" inDirectory:@"web"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[web loadRequest:request];
[web setDelegate:self];
[web loadRequest:request];
}
웹 페이지를 렌더링하는 PHP 스크립트를 실행하려고합니까? 코드를 실행하는 웹 서버를 실행하지 않으면 PHP를 제공 할 수 없기 때문입니다. 동일한 주제를 다루는 http://stackoverflow.com/questions/8326210/uiwebview-cant-display-php-files도 참조하십시오. – EWit