# CocoaHTTPServer
## 使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能。
CocoaHTTPServer在这里就不多做介绍,如果没有的话,可以的GitHub上去下载:[https://github.com/robbiehanson/CocoaHTTPServer](https://github.com/robbiehanson/CocoaHTTPServer)。
下面开始简单介绍一下CocoaHTTPServer的使用。
### 步骤1:
CocoaHTTPServer框架中的文件导入项目中,需要的文件有:
1. Core文件夹下所有文件
2. Vendor文件夹下所有文件
3. Samples -> SimpleFileUploadServer -> SimpleFileUploadServer -> MyHTTPConnection.h + MyHTTPConnection.m + web文件夹下所有文件
文件参考以下图片:
![](http://upload-images.jianshu.io/upload_images/4908799-8bd0f1c8b0b61804.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/150)
![](http://upload-images.jianshu.io/upload_images/4908799-5843eef0d02e5787.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/500)
### 步骤2:
在 MyHTTPConnection.m 文件的 processStartOfPartWithHeader: 方法中,找到对应的地方,修改文件存储位置(这里以Document为例),如下图所示:
![](http://upload-images.jianshu.io/upload_images/4908799-5088f8a0afe9e94b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/500)
### 步骤3:
配置 httpServer。代码中有一个获取ip地址的方法,可以在网上搜,只要能获取到手机设备的ip地址就可以了,然后封装成一个工具类(SJXCSMIPHelper)。
现在就可以运行一下代码,如下图:
![](http://upload-images.jianshu.io/upload_images/4908799-35286bf1672312d2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/500)
在网页输入ip地址和端口,就可以使用了。
![](http://upload-images.jianshu.io/upload_images/4908799-944b64a48f139ace.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300)
没有合适的资源?快使用搜索试试~ 我知道了~
swift-使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能
共81个文件
h:31个
m:30个
ds_store:5个
需积分: 50 11 下载量 20 浏览量
2019-08-15
05:47:36
上传
评论
收藏 207KB ZIP 举报
温馨提示
使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能
资源推荐
资源详情
资源评论
收起资源包目录
swift-使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能.zip (81个子文件)
HTTPServerDemo-master
.gitignore 1KB
README.md 2KB
HTTPServerDemo.xcodeproj
project.xcworkspace
contents.xcworkspacedata 159B
xcshareddata
IDEWorkspaceChecks.plist 238B
project.pbxproj 42KB
LICENSE 1KB
.DS_Store 6KB
HTTPServerDemo
AppDelegate.h 278B
MyHTTPConnection.m 7KB
ViewController.h 216B
Vendor
CocoaLumberjack
DDTTYLogger.m 47KB
DDLog.h 22KB
DDASLLogger.m 2KB
Extensions
ContextFilterLogFormatter.m 4KB
DispatchQueueLogFormatter.h 4KB
DispatchQueueLogFormatter.m 7KB
ContextFilterLogFormatter.h 2KB
README.txt 321B
DDAbstractDatabaseLogger.m 19KB
DDTTYLogger.h 6KB
About.txt 2KB
DDAbstractDatabaseLogger.h 4KB
.DS_Store 6KB
DDASLLogger.h 1KB
DDFileLogger.h 12KB
DDLog.m 32KB
DDFileLogger.m 37KB
CocoaAsyncSocket
GCDAsyncSocket.m 195KB
About.txt 204B
GCDAsyncSocket.h 49KB
.DS_Store 6KB
Base.lproj
Main.storyboard 2KB
LaunchScreen.storyboard 2KB
SJXCSMIPHelper.m 5KB
Assets.xcassets
AppIcon.appiconset
Contents.json 585B
Core
Mime
MultipartFormDataParser.h 2KB
MultipartFormDataParser.m 17KB
MultipartMessageHeader.m 2KB
MultipartMessageHeaderField.h 698B
MultipartMessageHeader.h 1KB
MultipartMessageHeaderField.m 6KB
HTTPServer.m 19KB
WebSocket.h 3KB
HTTPResponse.h 8KB
HTTPLogging.h 6KB
WebSocket.m 21KB
Responses
HTTPRedirectResponse.m 999B
HTTPDynamicFileResponse.h 2KB
HTTPDataResponse.h 196B
HTTPFileResponse.m 5KB
HTTPAsyncFileResponse.h 3KB
HTTPAsyncFileResponse.m 9KB
HTTPRedirectResponse.h 200B
HTTPDataResponse.m 2KB
HTTPFileResponse.h 425B
HTTPDynamicFileResponse.m 8KB
HTTPErrorResponse.h 159B
HTTPErrorResponse.m 488B
HTTPMessage.h 1KB
HTTPAuthenticationRequest.h 762B
Categories
DDNumber.h 341B
DDData.h 205B
DDRange.h 2KB
DDNumber.m 1KB
DDRange.m 2KB
DDData.m 4KB
HTTPAuthenticationRequest.m 6KB
HTTPConnection.h 3KB
HTTPMessage.m 3KB
HTTPServer.h 7KB
HTTPConnection.m 85KB
.DS_Store 6KB
web
index.html 469B
upload.html 227B
main.m 335B
Info.plist 1KB
SJXCSMIPHelper.h 358B
AppDelegate.m 2KB
.DS_Store 6KB
ViewController.m 5KB
MyHTTPConnection.h 230B
共 81 条
- 1
资源评论
weixin_39840924
- 粉丝: 492
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 机器学习和数据挖掘课程设计-米其林餐厅数据挖掘管理系统源码+使用文档说明.zip
- html html html展示我与ai的对化
- 数据结构课程设计-全国交通出行咨询模拟系统C语言实现源码.zip
- cef-binary-109.0.1+gcd5e37a+chromium-109.0.5414.8-windows32
- 基于C语言的全国交通咨询系统模拟源码.zip
- 正点原子HAL库 STM32F4 DMA(学习自用附源码)
- 炫酷代码雨,超级炫酷哦!!!
- 基于物联网MQTT协议的智能停车场管理系统
- POETIZE个人博客系统源码 - 最美博客
- 基于深度学习的行人检测系统源码+项目说明(YoloV3+Tensorflow).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功