A lightweight, one line setup, iOS / OSX network debugging library! 🦊

Last update: Jun 18, 2022

Netfox: A lightweight, one line setup, network debugging library

Version CI Status Cocoapods Compatible Carthage Compatible Platform License

Netfox provides a quick look on all executed network requests performed by your iOS or OSX app. It grabs all requests - of course yours, requests from 3rd party libraries (such as AFNetworking, Alamofire or else), UIWebViews, and more

Very useful and handy for network related issues and bugs

Supports Swift 4 and above - bridged also for Objective-C.

For Swift 3.2 support, use version 1.12.1.

Feel free to contribute :)

Overview

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. To integrate netfox into your Xcode project using CocoaPods, specify it in your Podfile:

use_frameworks!
pod 'netfox'

To bundle only on some build configurations specify them after pod.

use_frameworks!
pod 'netfox', :configurations => ['Debug', 'Test']

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate netfox into your Xcode project using Carthage, specify it in your Cartfile:

github "kasketis/netfox"

Manually

If you prefer not to use dependency managers, you can integrate netfox into your project manually.

You can do it by copying the "netfox" folder in your project (make sure that "Create groups" option is selected)

The above folder contains 3 subfolders: Core, iOS and OSX.

  • If you target on iOS keep only Core and iOS folders (remove OSX folder)
  • If you target on OSX keep only Core and OSX folders (remove iOS folder)

Start

Swift

// AppDelegate
import netfox
NFX.sharedInstance().start() // in didFinishLaunchingWithOptions:

Objective-C

// AppDelegate
[NFX.sharedInstance start]; // in didFinishLaunchingWithOptions:

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"

Usage

Just shake your device and check what's going right or wrong! Shake again and go back to your app!

Stop

Call

NFX.sharedInstance().stop()

to stop netfox and clear all saved data. If you stop netfox its view will not be displayed until you call start method again.

If you want to just enable/disable logging functionality or clear the data please use the buttons provided in the settings view

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.

Prevent logging for specific URLs

Use the following method to prevent requests for specified URL from being logged. You can ignore as many URLs as you want

NFX.sharedInstance().ignoreURL("the_url")

Tip: You can use the url of the host (for example "https://www.github.com") to ignore all paths of it

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)
  • Filtering: Select what types of responses (JSON/XML/HTML/Image/Other) you want to see
  • Enable/disable logging within the app
  • Clear data within the app
  • Statistics: Check cool things like average response time, total response size and more for your selected types of responses
  • Info: Check your IP address, your app version and build number and other things within the app
  • More to come.. ;)

Integrations

Droar: A modular, single-line installation debugging window.

Other

  • If you experience any problems with request logging please check this. If you don't get your answer please open an issue
  • Due to the large size of request/response bodies, the library provides disk storage for low memory overhead

Thanks

Special thanks to tbaranes and vincedev for their contribution on OSX library!

Licence

All source code is licensed under MIT License. Which means you could do virtually anything with the code. I will appreciate it very much if you keep an attribution where appropriate.

GitHub

https://github.com/kasketis/netfox
Comments
  • 1. OSX Support

    It takes a bit more time than expected (not enough free time), but here it is: OS X support! #42

    All the features has been copy from iOS, just missing:

    • Sharing by email: not sure if that necessary since the text can be selected / copy
    • README update
    • Git history improvements (squashed all the commits?)

    We test the OS X version in our project these last days , it was working well. So, I think, it would be ok, but maybe iOS needs to be tested again (since, we moved a lot stuff).

    From now on, I'm waiting your feedback on:

    • Interfaces
    • Code architecture / conception => If you want make some change, just ask!

    Hope you will like it :)

    screen shot 2016-02-08 at 18 18 38 screen shot 2016-02-08 at 18 18 43 screen shot 2016-02-08 at 18 18 49 screen shot 2016-02-08 at 18 18 55 screen shot 2016-02-08 at 18 18 32 screen shot 2016-02-08 at 18 18 26

    Reviewed by tbaranes at 2016-02-08 17:19
  • 2. Carthage support

    Hi, Very good work.

    Could you please share your schema to support carthage installation?

    https://github.com/Carthage/Carthage/blob/master/README.md#supporting-carthage-for-your-framework

    THX

    Reviewed by z4r at 2015-11-28 10:48
  • 3. OSX support

    Starting a first suggestion in #28 for OSX support, you seemed to be interested in it. Is there any work started yet? If no, would you be interested in a PR to handle it? (if I have the time to work on it...) Or just some helps?

    We are really interested on this since we already using Netfox in our iOS application :)

    Reviewed by tbaranes at 2016-01-07 18:29
  • 4. Integration with Alamofire in iOS 9 causes RTO

    The title says it all. I tried to configure Netfox 1.11.1 with Alamofire 4.6.0 using the workarounds here, with exception of NSURLSessionConfiguration's change from defaultSessionConfiguration() to default in Swift 4.

    This issue is not apparent when I try it in iOS 9 and higher, or when I didn't call the NFX.sharedInstance().start in iOS 9. The issue still persist when I tried newer version of Alamofire.

    Does anyone have this issue too? Any help would be appreciated! 😁

    Reviewed by edopelawi at 2018-04-06 10:24
  • 5. UIWebView does not behave as expected when netfox is enabled.

    We are using a third party payment gateway. Some of the tasks (like entering credit card ) are done in a webview. When netfox was enabled website was not behaving properly (Mostly probably because javascript were not loaded properly).

    Reviewed by 2ank3th at 2016-06-06 13:48
  • 6. Proper casing in project naming

    I've noticed that this is the only framework that I use that has the framework name lowercased. @kasketis - Was this intentional? Do you mind if we update it to Netfox instead of netfox?

    Reviewed by michaelfransen at 2015-12-12 01:14
  • 7. Netfox & Parse: can't see my Parse requests

    Not sure what could be the reason for that... Any idea? I see other requests (such ax Mixpanel and Facebook graph) but not Parse ones.

    But beside it - great idea and really really great and cool implematation!

    Thanks a lot!!

    Reviewed by oferRounds at 2015-11-30 20:27
  • 8. Exporting as HAR file

    Looking in the email, I received the following under the request section:

    -- Body --
    
    Too long to show. If you want to see it, please tap the following button
    

    We should maybe let exporting show the full body :)

    Reviewed by Janglinator at 2018-05-11 16:12
  • 9. Using Netfox without modal presentation

    I've created a project where I having a large selection of debugging tools built into one debugging window. Netfox is spectacular, and I'd like to add it as another section of the pod. However I don't wish to present it modally, but rather push it onto my existing navigation controller. Is there any way we could publicly expose the NFXListController class for custom usage?

    P.S. my library is in ObjC, so an @objc at the top would also be awesome!

    Reviewed by Janglinator at 2015-12-10 01:28
  • 10. KFSwiftImageLoader

    Great tool!

    Would you expect this to work with https://github.com/kiavashfaisali/KFSwiftImageLoader ?

    I'm able to see other request/responses in netfox, except for those...

    Reviewed by ghost at 2015-11-25 19:40
  • 11. Sponsorship / Donation

    Hello, The company I work for is organizing a donation wave to support projects/teams that are doing a tremendous job helping out the open source community. Netfox it's one of these, no doubt.

    Are you open for donations/sponsorship?

    Regards.

    Reviewed by GuilhE at 2021-12-06 09:40
  • 12. Netfox won't catch network calls

    Describe the bug My app will load, if I shake net fox I either get no network calls or really strange ones which have no relevance to anything my app has done

    My error:

    [NFX]: Failed to load data from [file:///private/var/mobile/Containers/Data/Application/38FADE5E-97EC-4AF3-BF84-7122D8B6E1B5/tmp/NFX/request_body_16:52_22F7C5D4-B195-4806-9B6C-944447C67526] - The file “request_body_16/52_22F7C5D4-B195-4806-9B6C-944447C67526” couldn’t be opened because there is no such file.

    Screenshots/Video If applicable, add screenshots/video to help explain your problem.

    Enviroment:

    • Device: [iPhone 12 Pro Max]
    • OS: [iOS 15.4]
    • Netfox version: [1.21.0]
    • Xcode version: [13.3.1 (13E500a)]
    • Swift version: [latest non beta release]
    Reviewed by B4DG3R at 2022-05-12 15:56
  • 13. Custom `URLSessionConfiguration.httpCookieStorage` is ignored

    Describe the bug Custom URLSessionConfiguration.httpCookieStorage are not honored:

    public extension Session {
        static let customSession: Session = {
            let sessionConfiguraton = URLSessionConfiguration.default
            sessionConfiguraton.protocolClasses?.insert(NFXProtocol.self, at: 0)
            sessionConfiguraton.httpCookieStorage = customCookieStorage
            return Session(configuration: sessionConfiguraton)
        }()
    }
    

    To Reproduce

    1. Use a custom httpCookieStorage. In our case, we use a HTTPCookieStorage.sharedCookieStorage(forGroupContainerIdentifier: "groupname") to share cookies between app and extensions
    2. Plug netfox, do any request
    3. Cookies are not added from / saved to the expected httpCookieStorage

    Expected behavior Cookies are get/set into the configured httpCookieStorage. Instead they seem to be saved into the default one.

    Additional context My guess is that cookie handling happens in the URLProtocol implementation that the NFXProtocol shadows. Internally the NFXProtocol uses a URLSession(configuration: .default, ...) session which doesn't use the httpCookieStorage we want it to use.

    I guess the solution is either or:

    1. (Ideally) Fix the NFXProtocol to use the httpCookieStorage. Unfortunately I am not familiar with URLProtocol so I don't know exactly what is missing here.
    2. (Probably good enought) Provide a way to configure the URLSession that NFXProtocol uses so we can configure it too
    Reviewed by guillermomuntaner at 2022-04-21 09:50
  • 14. NFXListController_iOS Unexpectedly found nil while implicitly unwrapping an Optional value

    Describe the bug when I open the netflix debugger, I get a crash stating that in the NFXListController_iOS file on line 128: Unexpectedly found nil while implicitly unwrapping an Optional value. then I checked on line 17, it seems that in force then the error occurs.

    Screenshots/Video Screen Shot 2022-04-07 at 14 27 04

    Screen Shot 2022-04-07 at 14 27 23

    Enviroment:

    • Device: Simulator iPhone 8 Plus
    • OS: iOS 14.5
    • Netfox version:1.20.0
    • Xcode version: 13.1
    • Swift version: 4

    Additional context Add any other context about the problem here.

    Reviewed by arifrach31 at 2022-04-07 07:41
  • 15. Upload Progress Method from Alamofire don't called when use netfox

    Describe the bug I use Alamofire for network request & netfox for logging the request. The uploadProgress closure never gets called if I enable the netfox like so NFX.sharedInstance().start() in AppDelegate.

    AF.upload(multipartFormData: { (multipartFormData) in
            multipartFormData.append(fileUrl, withName: "file")
            multipartFormData.append("\(id)".data(using: String.Encoding.utf8, allowLossyConversion: false)!, withName: "customer_id")
        }, to: Constants.kAddMedia, headers: Constants.kHeaders)
        .uploadProgress { (prgs) in
            progress(Float(prgs.fractionCompleted))
        }
        .responseJSON { response in
          // do my stuff 
        }
    }
    

    Enviroment:

    • Device: [e.g. iPhone 7]
    • OS: [e.g. iOS 15.1]
    • Netfox version: [e.g 1.20.0]
    • Alamofire version: [e.g 5.4]
    • Xcode version: [e.g 13.2.1]
    • Swift version: [e.g 5]

    Additional context here is the link to the issue from Alamofire

    Reviewed by anirudhamahale at 2022-02-08 12:15
Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder
Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder

Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder

Jun 7, 2022
Digger is a lightweight download framework that requires only one line of code to complete the file download task
Digger is a lightweight download framework that requires only one line of code to complete the file download task

中文说明 Digger is a lightweight download framework that requires only one line of code to complete the file download task. Based on URLSession, pure Swif

Jun 27, 2022
NWReachability - a pure Swift library for monitoring the network connection of iOS devices using Apple's Network framework.

NWReachability is a pure Swift library for monitoring the network connection of iOS devices using Apple's Network framework.

Mar 4, 2022
Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application.
Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application.

Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application. Install Carthage

Jan 21, 2022
A network extension app to block a user input URI. Meant as a network extension filter proof of concept.
A network extension app to block a user input URI. Meant as a network extension filter proof of concept.

URIBlockNE A network extension app to block a user input URI. Meant as a network extension filter proof of concept. This is just a research effort to

Nov 19, 2021
Say goodbye to the Fat ugly singleton Network Manager with this Network Layer

MHNetwork Protocol Oriented Network Layer Aim to avoid having bloated singleton NetworkManager Philosophy the main philosophy behind MHNetwork is to h

Apr 6, 2022
Setup your class structure in Xcode Interface Builder and save() in Parse Server.
Setup your class structure in Xcode Interface Builder and save() in Parse Server.

ISParseBind With ISParseBind you can save, update and query PFObjects using the power of Xcode Interface Builder resources. https://www.youtube.com/wa

Mar 28, 2022
A lightweight but powerful network library with simplified and expressive syntax based on AFNetworking.
A lightweight but powerful network library with simplified and expressive syntax based on AFNetworking.

XMNetworking English Document XMNetworking 是一个轻量的、简单易用但功能强大的网络库,基于 AFNetworking 3.0+ 封装。 其中,XM 前缀是我们团队 Xcode-Men 的缩写。 简介 如上图所示,XMNetworking 采用中心化的设计思想

Jun 16, 2022
Lightweight network abstraction layer, written on top of Alamofire
Lightweight network abstraction layer, written on top of Alamofire

TRON is a lightweight network abstraction layer, built on top of Alamofire. It can be used to dramatically simplify interacting with RESTful JSON web-

Jun 17, 2022
Conforming WebSocket (RFC 6455) client library for iOS and Mac OSX
Conforming WebSocket (RFC 6455) client library for iOS and Mac OSX

SwiftWebSocket Conforming WebSocket (RFC 6455) client library for iOS and Mac OS

Dec 24, 2021
SwiftCANLib is a library used to process Controller Area Network (CAN) frames utilizing the Linux kernel open source library SOCKETCAN.

SwiftCANLib SwiftCANLib is a library used to process Controller Area Network (CAN) frames utilizing the Linux kernel open source library SOCKETCAN. Th

Oct 25, 2021
Websockets in swift for iOS and OSX
Websockets in swift for iOS and OSX

Starscream is a conforming WebSocket (RFC 6455) library in Swift. Features Conforms to all of the base Autobahn test suite. Nonblocking. Everything ha

Jun 23, 2022
Fast Websockets in Swift for iOS and OSX
Fast Websockets in Swift for iOS and OSX

SwiftWebSocket Conforming WebSocket (RFC 6455) client library for iOS and Mac OSX. SwiftWebSocket passes all 521 of the Autobahn's fuzzing tests, incl

Jun 21, 2022
WKZombie is an iOS/OSX web-browser without a graphical user interface.
WKZombie is an iOS/OSX web-browser without a graphical user interface.

WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser. It can be used to run automated tests / snapshots and manipulate websites using Javascript.

Jun 16, 2022
Socket.io iOS and OSX Client compatible with v1.0 and later
Socket.io iOS and OSX Client compatible with v1.0 and later

SocketIO-Kit ⚠️ This project is no longer maintained. Please use the official framework Socket.IO-Client-Swift. SocketIO-Kit is a Socket.io iOS client

Mar 9, 2022
Easy-to-use ICMP Ping for iOS (and maybe OSX)

CDZPinger Easy-to-use ICMP ping for iOS - just create a CDZPinger and you delegate gets a callback every second with the average ping time. Installati

Feb 2, 2022
An iOS LAN Network Scanner library
An iOS LAN  Network Scanner library

MMLanScan MMLanScan is an open source project for iOS that helps you scan your network and shows the available devices and their MAC Address, hostname

Jun 7, 2022
A light weight network library with automated model parser for rapid development

Gem A light weight network library with automated model parser for rapid development. Managing all http request with automated model parser calls in a

Sep 24, 2020
A new, clean and lean network interface reachability library written in Swift.

Reachability A new, clean and lean network interface reachability library written in Swift. Remarks Network reachability changes can be monitored usin

May 30, 2022