Run a Web Server from an iPhone App
来源:互联网 发布:warframe淘宝买白金 编辑:程序博客网 时间:2024/06/06 03:27
转自:http://www.mokten.com/2011/12/run-a-web-server-from-an-iphone-app/
Run a Web Server from an iPhone App
Yoo-Jin Lee Wed, Dec 14, 2011If you ever needed to run a simple web server from an iPhone App here is one way to do it.
This example uses a lightweight web server cocoahttpserver and a sleep timer based onMMPDeepSleepPreventer by Marco Peluso.
Key Points
- Running a web server from an iPhone App is possible but will not respond when in the suspended or terminated state
- Stop the iPhone App going to the suspended state, when exiting, by playing an empty audio file
- Playing an audio file does not work in the iOS Simulator v5.0. So you need to test this on a device.
- Background executiion is only available in iOS 4 and later
- Reference: iOS Developer Library
Overview
- MTAudioPlayer.m: plays an empty audio file that loops forever
- Based on old version of MMPDeepSleepPreventer by Marco Peluso
- Needed to be modified because the the periodic thread scheduling was not working in iOS 5
- iPhoneHTTPServer-Info.plist
- Add property: Required background modes: App plays audio
- iPhoneHTTPServerViewController.m: Opens up the localhost server URL and should show /Web/index.html
Full sample code: cocoahttpserver
Run the sample: /Samples/iPhoneHTTPServer
- Run a Web Server from an iPhone App
- 病毒-Run a DLL as an APP
- Launching the App Store from an iPhone application
- 关于run a dll as an app的问题
- Run a dll as an App提示的解决
- How to run an existing SQL Server Agent Job from C#
- ios 命令行编译 Build an iPhone app from the command line
- Run an Excel macro from QuickTest Professional
- 弹出run a dll as an app对话框&关机蓝屏的解决方法
- How To Create A Socket Based iPhone App and Server
- Building an IIS web server on a home LAN
- WC2010Camera-A iPhone APP
- Run a program from within a program
- There was a problem getting an AppDomain to run the transformation from the host. The process cannot
- Android Tutorial: How To Post Data From An Android App To a Website
- web server+app server
- Embed client-side JavaScript in an ASP.NET 1.1 web page from server side code
- How To Retrieve the URL of a Web Page from an ActiveX Control
- .Net中常用的加密解密介绍
- 安装下载node.js通过msnodesql访问SQL Server
- Gibonacci number
- 复选框功能
- Android - Binder机制 - 普通service注册
- Run a Web Server from an iPhone App
- 设计模式-策略模式
- 三级联动代码优化
- 最好用的安卓反编译、编译工具-AntiDroid V1.4.3发布了
- OpenStack Grizzly Quantum Multihost 部署
- 国外程序员推荐:每个程序员都应读的书
- 新年福利,个人项目Makefile模板
- 单元测试
- hdu 1671 Phone List