开发者

HTTP server on iPhone?

I am using cocoa http server on iPhone. Its working fine if I set a root document. But I want to list all the contents of my "Document directory". I tried setting the root document to the document's directory path

NSArray *directories = NSSearchPa开发者_高级运维thForDirectoriesInDomains(NSDocumentsDirectory, NSUserDomainMask, YES);
NSString *rootDir = [directories lastObject];
[httpServer setDocumentRoot:rootDir];

(I tried getting the path programatically)

But its not working ... any idea on this or is there any opensource project that I can use to list the content of my document directory?

Update : here is link to the project (cocoa http server)


You could try Mongoose and it's Objective-C Wrapper. It seems Mongoose natively supports directory listing.


You must use;

NSArray *directories = NSSearchPathForDirectoriesInDomains(NSDocumentsDirectory, NSUserDomainMask, YES);
NSString *rootDir = [directories lastObject];
[httpServer setDocumentRoot:rootDir];

because the GUID for the app changes on every install (i.e. the number starting with 8D41 in your dir above).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜