1

I want to embed a webserver in an iPhone app so as to download files from application's document directory. I am using iPhone Http Server.

Everything works fine on iPhone simulator. Even I am able to get files using http://: or localhost:.

But on device I am not able to connect. Safari says: "Cannot open page". Even http://iphone.local: doest not work on same device as app is installed.

Please suggest.

4

1 に答える 1

3

Your app goes into background, doesn't it? I think you use Mac's Safari when you try your app in iOS Simulator. And when you try it on iPhone, your app is in background and iPhone's Safari is foreground.

If so, I believe the following helps you:

cocoaHTTPServer doesn't work in background. Try keep your app foreground and access it from other machine.

And, there is no way to maintain server functionality all the time... https://devforums.apple.com/message/706241

于 2012-09-03T10:38:31.730 に答える