GCDWebServer 有什么用? [英] What is GCDWebServer for?

查看:96
本文介绍了GCDWebServer 有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 iOS8 中从 WKWebView 加载本地 Web 时遇到问题.有一些建议我应该使用 GCDWebServer.我通读了 GCDWebServer,但并不真正了解 GCDWebServer 在移动应用程序方面的用途.

I have a problem when loading the local web from WKWebView in iOS8. There are some suggestions that I should use GCDWebServer. I read through GCDWebServer, but not really understand what GCDWebServer is for on mobile application's side.

你能给我任何使用这个库的实际案例吗?抱歉我的无知.

Could you give me any practical case of using this library? Sorry for my ignorance.

推荐答案

这是一个可以在 iOS 设备上运行的网络服务器.就像您在 VPS 或专用服务器提供商上运行网络服务器一样.

It's a webserver that you can run on your iOS device. Just like you would run a webserver on VPS or dedicated server providers.

您将从 iOS 应用运行和托管的这个网络服务器当然只能在您的 iOS 设备所连接的网络中使用.

This webserver that you would run and host from your iOS app will of course be available only in the network your iOS device is connected to.

这使您可以在连接到该网络的其他机器上编写客户端程序或脚本,调用您的 iOS 应用程序(运行 GCDWebServer)来上传或下载您选择存储在 iOS 应用程序沙箱中的文件例如文档目录.或者像查看 HTML 或其他数据一样简单 - 纯文本或 json - 由 GCDWebServer 提供.

This makes it useful for you to write client programs or scripts on other machines but connected to that network, to call your iOS app (running the GCDWebServer) to upload or download files that you so choose to store in your iOS app's sandboxes document directory for instance. Or as simple as viewing HTML or other data - plain text or json - served by GCDWebServer.

它与什么 WKWebView 无关.WKWebView 是一个简化的 WebKit 浏览器客户端",您可以在您的 iOS 应用中实现它,以查看从其他网络服务器主机提供的网页.

It had nothing to do with what WKWebView. WKWebView is a 'simplified WebKit browser client' that you can implement in your iOS app to view web pages served from other webserver hosts.

您可以将 WKWebView 视为 GCDWebServer 的完全相反.

You can think of WKWebView as the complete opposite of GCDWebServer.

这篇关于GCDWebServer 有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆