iOS的网络调试库:netfox

jopen 8年前

iOS的网络调试库:netfox

一个轻量级,一行代码安装,网络调试库。可以快速查看由您的应用程序执行的所有执行网络请求。它收集了所有的请求 - 包括从第三方库(如AFNetworking,UIWebViews等的请求。

非常方便和实用的网络相关的问题和错误。

Implemented in Swift 2.1 - bridged also for Objective-C

Feel free to contribute :)

Overview

iOS的网络调试库:netfox

Installation

Copy the “nfx” folder in your project (make sure that “Create groups” option is selected) and add the following line in didFinishLaunchingWithOptions: method of your AppDelegate

Swift

NFX.sharedInstance().start()

Objective-C

[[NFX sharedInstance] start];

Just simple as that!

Note: Please wrap the above line with

#if DEBUG  . . .  #endif

to prevent library’s execution on your production app.

You can add the DEBUG symbol with the -DDEBUG entry. Set it in the “Swift Compiler - Custom Flags” section -> “Other Swift Flags” line in project’s “Build Settings”

Pod

On the way.. :)

Usage

Just shake your device and check what's going right or wrong! Shake again and go back to your app! fact iOS的网络调试库:netfox

Custom gestures

By default the library registers for shake motion. If you want to open the logs with a different gesture, add the following line after the installation one

NFX.sharedInstance().setGesture(.custom)

Then you can use

NFX.sharedInstance().show()

when you want to show the logs and

NFX.sharedInstance().hide()

when you want to hide them.

Features

  • Search: You can easily search among requests via
    • Request url: github.com, .gr, or whatever you want
    • Request method: GET, POST, etc
    • Response type: Like json, xml, html, image and more
  • Sharing: You can share your log via email with backend devs or someone who can help.
    • Simple log option includes only request/response headers and small request/response bodies (when applicable)
    • Full log option includes request/response headers and request/response bodies (as attachments)
  • More to come.. ;)

项目主页:http://www.open-open.com/lib/view/home/1448372967704