如何在iOS上托管HTTP web服务?
我需要制作一个HTTP web服务或HTTP操作页面,托管在iPad或任何iOS设备上。 应使用如何在iOS上托管HTTP web服务?,ios,objective-c,Ios,Objective C,我需要制作一个HTTP web服务或HTTP操作页面,托管在iPad或任何iOS设备上。 应使用HTTPRequest或使用NSURLConnection从同一网络上连接的其他设备访问此服务 任何建议都会很有用。您需要一个用cocoa编写的web服务器,它运行在您的应用程序中,并通过HTTP提供对文件的访问 无耻的插件:请参阅我的DDSimpleHTTPd——它是一个在iOS设备上运行的基本Web服务器 在viewController/appDelegate中,按如下方式启动它,以在指定目录
HTTPRequest
或使用NSURLConnection
从同一网络上连接的其他设备访问此服务
任何建议都会很有用。您需要一个用cocoa编写的web服务器,它运行在您的应用程序中,并通过HTTP提供对文件的访问
无耻的插件:请参阅我的DDSimpleHTTPd——它是一个在iOS设备上运行的基本Web服务器 在viewController/appDelegate中,按如下方式启动它,以在指定目录中为任何文件提供服务器:
NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSString *path = url.path;
SimpleHTTPResponder *simpleServer = [[SimpleHTTPResponder alloc] init];
simpleServer.port = 8000;
simpleServer.webRoot = path;
simpleServer.bonjourName = @"test"; //optional: allow it to be found via bonjour
simpleServer.loggingEnabled = YES; //optional: do NSLogs of the requests that come in
simpleServer.autogenerateIndex = YES; //optional: generate a directory overview
[simpleServer startListening];