在iphone上创建小型服务器,并且让其处于后台的时候服务器仍然处于运行状态
来源:互联网 发布:天猫淘宝网商城梳妆台 编辑:程序博客网 时间:2024/04/30 01:04
转自: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
- 在iphone上创建小型服务器,并且让其处于后台的时候服务器仍然处于运行状态
- 在iphone上创建小型服务器,并且让其处于后台的时候服务器仍然处于运行状态
- 小型的http服务器处于维护中
- 如何将一个 镜像 pull到docker服务器上,并且实现该image 处于 up状态?
- SQL4414N “DB2 管理服务器”处于不活动状态 的处理
- 手机网页js计时器在浏览器处于后台的时候被冷冻的问题。
- 条件查询的时候,查询完成之后,不用在将选择的数据回传到页面,用于判断,让选择的option处于SELECT状态。
- DataGridView处于编辑状态的时候不响应Keyup事件
- UITableView处于编辑状态所在页面消失的时候崩溃
- 点击tabbarItem的时候判断用户是否处于登录状态
- 解决新建数据库时的错误 SQL4414N “DB2 管理服务器”处于不活动状态
- 未找到地址列表处于活动状态的exchange 2007服务器
- 在android中如何判断当前的apk是否处于运行状态
- 如何让自己的工作状态一直处于饱满??
- 如何让ListCtrl的CheckBox只有一个处于选中状态
- 如何让ListCtrl的CheckBox只有一个处于选中状态
- 如何让ListCtrl的CheckBox只有一个处于选中状态
- 项目处于艰难的时候
- android执行外部程序,类似DELPHI里的EXEC函数
- XP iis 无法启动提示 服务没有及时响应启动或者控制请求==解决方案
- jbpm学习笔记(一)--开发环境配置
- 所有常见证书处理函数的实现
- 虚拟机装Linux 克隆出的网卡出问题
- 在iphone上创建小型服务器,并且让其处于后台的时候服务器仍然处于运行状态
- json-c发segmentation fault问题
- 编写算法输出从n个数中取k个(k小于等于n)的所有组合
- 避免UITableViewCell重叠的解决方法
- 运行loadrunner,打不开IE问题处理方法
- Project Server(PWA)的使用
- android:windowSoftInputMode属性详解
- Extending and Embedding PHP-扩展和移植PHP(六)
- jQuery中return false,e.preventDefault(),e.stopPropagation()的区别