iphone - Cocoa Server Question -
I am trying to host several files on a server on iOS devices, and I want to show a simple yet. text file. How do I change this code to display the HTML file in the document directory? Thanks!
- (zero) Startup Security {NSDTa * FileData = [NSDATA DataWhat ContentAufFile: [APPETFETEFFLAREPRESSPATHERFARFFULL]]; CFHTTPMessageRef Reaction = CFHTTPMessageCreateResponse (KCFALOketerDefault, 200, NULL, KCFHTPWers1_1); CFHTTPMessageSetHeaderFieldValue (response, (CFStringRef) @ "content type", (CFStringRef) @ "text / plain"); CFHTTPMessageSetHeaderFieldValue (feedback, "CFStringRef" @ "Connection", ("CFStringRef" @ "Off"); CFHTTPMessageSetHeaderFieldValue (Reaction, (CFStringRef) @ "Content-Length", (CF Stringerf) [NSString stringWithFormat: @ "% ld", [File Length of Data]]); CFDataRef header data = CFTHMMSpccrylised message (response); @tips {[fileHandle writeData: (NSData *) header data]; [FileHandle WriteData: FileData]; } @chich (NSE expansion * exception) {// Ignore the exception, this usually means that the client // has closed the connection from the other end} @ Finally {CFRighase (header data); [Server closed handler: self]; }}
Change the content type from text / side to text / html and make sure That pathForFile is pointing to an HTML file.
Comments
Post a Comment