• Stars
    star
    5,867
  • Rank 6,565 (Top 0.2 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 11 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Remote network and data debugging for your native iOS app using Chrome Developer Tools

PonyDebugger Logo

PonyDebugger

CI Status Version License Platform

PonyDebugger is a remote debugging toolset. It is a client library and gateway server combination that uses Chrome Developer Tools on your browser to debug your application's network traffic and managed object contexts.

To use PonyDebugger, you must implement the client in your application and connect it to the gateway server. There is currently an iOS client and the gateway server.

PonyDebugger is licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).

Changes

v0.4.0 - 2014-08-15

  • Support NSURLSession requests for the Network Debugger. (@viteinfinite)
  • New test application that removes the AFNetworking dependency. (@viteinfinite)
  • Remove custom base64 implementation with Apple's built-in implementation. (@kyleve)
  • Add PodSpec for pulling the git repository directly. (@wlue)

v0.3.1 - 2014-01-02

  • Fix only building active arch in debug. (@kyleve)
  • Fix view hierarchy debugging with complex key paths. (@ryanolsonk)
  • Fix crash in swizzled exchangeSubviewAtIndex:withSubviewAtIndex: (@ryanolsonk)
  • Fix for crash when having a library that looks like a NSURLConnectionDelegate (@peterwilli)

v0.3.0 - 2013-05-01

  • Remote Logging and Introspection (@wlue)
  • Request response pretty printing in Network Debugger (@davidapgar)
  • Minor bug fixes and improvements. (@jerryhjones, @conradev, @ryanolsonk)

v0.2.1-beta1 - 2013-01-12

  • Bonjour support (@jeanregisser)
  • Memory leak fix (@rwickliffe)

Features

Network Traffic Debugging

PonyDebugger sends your application's network traffic through ponyd, PonyDebugger's proxy server. You use Inspector's Network tools to debug network traffic like how you would debug network traffic on a website in Google Chrome.

PonyDebugger Network Debugging Screenshot

PonyDebugger forwards network traffic, and does not sniff network traffic. This means that traffic sent over a secure protocol (https) is debuggable.

Currently, the iOS client automatically proxies data that is sent via NSURLConnection and NSURLSession methods. This means that it will automatically work with AFNetworking, and other libraries that use NSURLConnection or NSURLSession for network requests.

Core Data Browser

The Core Data browsing feature allows you to register your application's NSManagedObjectContexts and browse all of its entities and managed objects. You browse data from the IndexedDB section in the Resource tab in Chrome Developer Tools.

PonyDebugger Core Data Browser Screenshot

These are read-only stores at the moment. There are plans to implement data mutation in a future release.

View Hierarchy Debugging

PonyDebugger displays your application's view hierarchy in the Elements tab of the Chrome Developer Tools. As you move through the XML tree, the corresponding views are highlighted in your app. You can edit the displayed attributes (i.e. frame, alpha, ...) straight from the Elements tab, and you can change which attributes to display by giving PonyDebugger an array of UIView key paths. Deleting a node in the elements panel will remove that node from the view hierarchy. Finally, when a view is highlighted, you can move it or resize it from the app using pan and pinch gestures.

PonyDebugger View Hierarchy Debugging Screenshot

An "inspect" mode can be entered by clicking on the magnifying glass in the lower left corner of the Developer Tools window. In this mode, tapping on a view in the iOS app will select the corresponding node in the elements panel. You can also hold and drag your finger around to see the different views highlighted. When you lift your finger, the highlighted view will be selected in the elements panel.

Currently only a subset of the actions possible from the elements panel have been implemented. There is significant room for continued work and improvement, but the current functionality should prove useful nonetheless.

Remote Logging

PonyDebugger lets you remotely log text and object dumps via the PDLog and PDLogObjects function. This lets you reduce the amount of content being logged in NSLog, while also allowing you to dynamically introspect objects.

PonyDebugger Remote Login Screenshot

Introspected objects can be expanded recursively by property. This means that you don't have to breakpoint and log in GDB or LLDB to introspect an object.

Quick Start

Prerequisite: Xcode's Command Line Tools must be installed from the "Downloads" preference pane.

curl -s https://cloud.github.com/downloads/square/PonyDebugger/bootstrap-ponyd.py | \
  python - --ponyd-symlink=/usr/local/bin/ponyd ~/Library/PonyDebugger

This will install ponyd script to ~/Library/PonyDebugger/bin/ponyd and attempt to symlink /usr/local/bin/ponyd to it. It will also download the latest chrome dev tools source.

Then start the PonyDebugger gateway server

ponyd serve --listen-interface=127.0.0.1

In your browser, navigate to http://localhost:9000. You should see the PonyGateway lobby. Now you need to integrate the client to your application.

For more detailed instructions, check out the gateway server README_ponyd.

PonyDebugger iOS Client

The PonyDebugger iOS client lets you to debug your application's network requests and track your managed object contexts.

Technical

  • Requires iOS 5.0 or above
  • Uses ARC (Automatic Reference Counting).
  • Uses SocketRocket as a WebSocket client.

Installing

CocoaPods

CocoaPods automates 3rd party dependencies in Objective-C.

Install the ruby gem.

$ sudo gem install cocoapods
$ pod setup

Depending on your Ruby installation, you may not have to run as sudo to install the cocoapods gem.

Create a Podfile. You must be running on iOS 5 or above.

platform :ios, '5.0'
pod 'PonyDebugger', '~> 0.4.3'

If you would like to use the latest version of PonyDebugger, point to the Github repository directly.

pod 'PonyDebugger', :git => 'https://github.com/square/PonyDebugger.git'

Install dependencies.

$ pod install

When using CocoaPods, you must open the .xcworkspace file instead of the project file when building your project.

Manual Installation

  • Extract a tarball or zipball of the repository into your project directory. If you prefer, you may also add the project as a submodule. The iOS client uses SocketRocket as a dependency, and it is included as a submodule.
cd /path/to/YourApplication
mkdir Frameworks
git submodule add git://github.com/square/PonyDebugger.git Frameworks/PonyDebugger
git submodule update --init --recursive
  • Add PonyDebugger/PonyDebugger.xcodeproj as a subproject.

PonyDebugger Installing Subproject

  • In your Project Settings, add the PonyDebugger target as a Target Dependency in the Build Phases tab.

PonyDebugger Installing Target Dependencies

  • Link libPonyDebugger.a, libSocketRocket.a, and the Framework dependencies to your project.

PonyDebugger Installing Link Libraries and Frameworks

  • PonyDebugger and SocketRocket take advantage of Objective C's ability to add categories on an object, but this isn't enabled for static libraries by default. To enable this, add the -ObjC flag to the "Other Linker Flags" build setting.

PonyDebugger Installing Other Linker Flags

Framework Dependencies

Your .app must be linked against the following frameworks/dylibs in addition to libPonyDebugger.a and libSocketRocket.a.

  • libicucore.dylib
  • CFNetwork.framework
  • CoreData.framework
  • Security.framework
  • Foundation.framework

Usage

PonyDebugger's main entry points exist in the PDDebugger singleton.

PDDebugger *debugger = [PDDebugger defaultInstance];

To connect automatically to the PonyGateway on your LAN (via Bonjour):

[debugger autoConnect];

Or to open the connection to a specific host, for instance ws://localhost:9000/device:

[debugger connectToURL:[NSURL URLWithString:@"ws://localhost:9000/device"]];

To manually close the connection:

[debugger disconnect];

Network Traffic Debugging

To enable network debugging:

[debugger enableNetworkTrafficDebugging];

PonyDebugger inspects network data by injecting logic into NSURLConnectionDelegate classes. If you want PonyDebugger to automatically find these classes for you:

[debugger forwardAllNetworkTraffic];

This will swizzle methods from private APIs, so you should ensure that this only gets invoked in debug builds. To manually specify delegate classes:

[debugger forwardNetworkTrafficFromDelegateClass:[MyClass class]];

These methods should be invoked before the connection is opened.

Core Data Browser

PonyDebugger also allows you to browse your application's managed objects. First, enable Core Data debugging:

[debugger enableCoreDataDebugging];

To register a managed object context:

[debugger addManagedObjectContext:self.managedObjectContext withName:@"My MOC"];

View Hierarchy Debugging

To enable view hierarchy debugging:

[debugger enableViewHierarchyDebugging];

PonyDebugger will inject logic into UIView add/remove methods to monitor changes in the view hierarchy.

You can also set the attributes you want to see in the elements panel by passing an array of UIView key path strings

[debugger setDisplayedViewAttributeKeyPaths:@[@"frame", @"hidden", @"alpha", @"opaque"]];

PonyDebugger uses KVO to monitor changes in the attributes of all views in the hierarchy, so the information in the elements panel stays fresh.

Remote Logging

To enable remote logging:

[debugger enableRemoteLogging];

Example usage:

PDLog("Hello world!");               // This logs a simple string to the console output.
PDLogObjects(self);                  // This logs an introspectable version of "self" to the console.
PDLogObjects("My object:", object);  // Combination of text and introspectable object.

The repository contains a test application to demonstrate PonyDebugger's capabilities and usage.

Known Issues / Improvements

  • CoreData.framework must be linked, even if you do not use the Core Data browsing functionality.

  • iOS 5.1 and below: In certain cases, -[NSURLConnectionDataDelegate connection:willSendRequest:redirectResponse:] will never get called. PonyDebugger requires this call to know when the request was sent, and will warn you with a workaround that the timestamp is inaccurate.

    To fix the timestamp, make sure that Accept-Encoding HTTP header in your NSURLRequest is not set (by default, iOS will set it to gzip, deflate, which is usually adequate.

    AFNetworking users: if you subclass AFHTTPClient, call [self setDefaultHeader:@"Accept-Encoding" value:nil];.

Contributing

Weโ€™re glad youโ€™re interested in PonyDebugger, and weโ€™d love to see where you take it. Please read our contributing guidelines prior to submitting a Pull Request.

Some useful links:

More Repositories

1

okhttp

Squareโ€™s meticulous HTTP client for the JVM, Android, and GraalVM.
Kotlin
45,250
star
2

retrofit

A type-safe HTTP client for Android and the JVM
HTML
42,581
star
3

leakcanary

A memory leak detection library for Android.
Kotlin
29,130
star
4

picasso

A powerful image downloading and caching library for Android
Kotlin
18,656
star
5

javapoet

A Java API for generating .java source files.
Java
10,691
star
6

moshi

A modern JSON library for Kotlin and Java.
Kotlin
9,502
star
7

okio

A modern I/O library for Android, Java, and Kotlin Multiplatform.
Kotlin
8,667
star
8

dagger

A fast dependency injector for Android and Java.
Java
7,317
star
9

crossfilter

Fast n-dimensional filtering and grouping of records.
JavaScript
6,222
star
10

maximum-awesome

Config files for vim and tmux.
Ruby
5,706
star
11

otto

An enhanced Guava-based event bus with emphasis on Android support.
Java
5,174
star
12

cubism

Cubism.js: A JavaScript library for time series visualization.
JavaScript
4,930
star
13

sqlbrite

A lightweight wrapper around SQLiteOpenHelper which introduces reactive stream semantics to SQL operations.
Java
4,574
star
14

android-times-square

Standalone Android widget for picking a single date from a calendar view.
Java
4,437
star
15

wire

gRPC and protocol buffers for Android, Kotlin, Swift and Java.
Kotlin
4,174
star
16

Valet

Valet lets you securely store data in the iOS, tvOS, or macOS Keychain without knowing a thing about how the Keychain works. Itโ€™s easy. We promise.
Swift
3,957
star
17

cube

Cube: A system for time series visualization.
JavaScript
3,912
star
18

kotlinpoet

A Kotlin API for generating .kt source files.
Kotlin
3,805
star
19

java-code-styles

IntelliJ IDEA code style settings for Square's Java and Android projects.
Shell
2,957
star
20

flow

Name UI states, navigate between them, remember where you've been.
Java
2,789
star
21

spoon

Distributing instrumentation tests to all your Androids.
HTML
2,700
star
22

keywhiz

A system for distributing and managing secrets
Java
2,614
star
23

tape

A lightning fast, transactional, file-based FIFO for Android and Java.
Java
2,459
star
24

certstrap

Tools to bootstrap CAs, certificate requests, and signed certificates.
Go
2,194
star
25

mortar

A simple library that makes it easy to pair thin views with dedicated controllers, isolated from most of the vagaries of the Activity life cycle.
Java
2,159
star
26

go-jose

An implementation of JOSE standards (JWE, JWS, JWT) in Go
1,981
star
27

Cleanse

Lightweight Swift Dependency Injection Framework
Swift
1,773
star
28

assertj-android

A set of AssertJ helpers geared toward testing Android.
Java
1,578
star
29

haha

DEPRECATED Java library to automate the analysis of Android heap dumps.
Java
1,436
star
30

phrase

Phrase is an Android string resource templating library
Java
1,403
star
31

cane

Code quality threshold checking as part of your build
Ruby
1,325
star
32

seismic

Android device shake detection.
Java
1,275
star
33

anvil

A Kotlin compiler plugin to make dependency injection with Dagger 2 easier.
Kotlin
1,265
star
34

sudo_pair

Plugin for sudo that requires another human to approve and monitor privileged sudo sessions
Rust
1,230
star
35

spacecommander

Commit fully-formatted Objective-C as a team without even trying.
Objective-C
1,126
star
36

square.github.io

A simple, static portal which outlines our open source offerings.
CSS
1,108
star
37

workflow

A Swift and Kotlin library for making composable state machines, and UIs driven by those state machines.
Shell
1,107
star
38

workflow-kotlin

A Swift and Kotlin library for making composable state machines, and UIs driven by those state machines.
Kotlin
982
star
39

certigo

A utility to examine and validate certificates in a variety of formats
Go
917
star
40

logcat

I CAN HAZ LOGZ?
Kotlin
893
star
41

radiography

Text-ray goggles for your Android UI.
Kotlin
831
star
42

whorlwind

Makes fingerprint encryption a breeze.
Java
819
star
43

dagger-intellij-plugin

An IntelliJ IDEA plugin for Dagger which provides insight into how injections and providers are used.
Java
798
star
44

cycler

Kotlin
793
star
45

Paralayout

Paralayout is a set of simple, useful, and straightforward utilities that enable pixel-perfect layout in iOS. Your designers will love you.
Swift
771
star
46

apropos

A simple way to serve up appropriate images for every visitor.
Ruby
766
star
47

shift

shift is an application that helps you run schema migrations on MySQL databases
Ruby
735
star
48

coordinators

Simple MVWhatever for Android
Java
703
star
49

subzero

Block's Bitcoin Cold Storage solution.
C
667
star
50

Blueprint

Declarative UI construction for iOS, written in Swift
Swift
659
star
51

shuttle

String extraction, translation and export tools for the 21st century. "Moving strings around so you don't have to"
Ruby
657
star
52

gifencoder

A pure Java library implementing the GIF89a specification. Suitable for use on Android.
Java
654
star
53

pollexor

Java client for the Thumbor image service which allows you to build URIs in an expressive fashion using a fluent API.
Java
633
star
54

intro-to-d3

a D3.js tutorial
CSS
603
star
55

kochiku

Shard your builds for fun and profit
Ruby
602
star
56

curtains

Lift the curtain on Android Windows!
Kotlin
570
star
57

RxIdler

An IdlingResource for Espresso which wraps an RxJava Scheduler.
Java
512
star
58

svelte-store

TypeScript
494
star
59

field-kit

FieldKit lets you take control of your text fields.
JavaScript
463
star
60

burst

A unit testing library for varying test data.
Java
462
star
61

SuperDelegate

SuperDelegate provides a clean application delegate interface and protects you from bugs in the application lifecycle
Swift
454
star
62

otto-intellij-plugin

An IntelliJ IDEA plugin to navigate between events posted by Otto.
Java
453
star
63

js-jose

JavaScript library to encrypt/decrypt data in JSON Web Encryption (JWE) format and to sign/verify data in JSON Web Signature (JWS) format. Leverages Browser's native WebCrypto API.
JavaScript
424
star
64

sharkey

Sharkey is a service for managing certificates for use by OpenSSH
Go
390
star
65

connect-api-examples

Code samples demonstrating the functionality of the Square Connect API
JavaScript
381
star
66

fdoc

Documentation format and verification
Ruby
379
star
67

ETL

Extract, Transform, and Load data with Ruby
Ruby
377
star
68

lgtm

Simple object validation for JavaScript.
JavaScript
366
star
69

laravel-hyrule

Object-oriented, composable, fluent API for writing validations in Laravel
PHP
341
star
70

in-app-payments-flutter-plugin

Flutter Plugin for Square In-App Payments SDK
Objective-C
332
star
71

papa

PAPA: Performance of Android Production Applications
Kotlin
331
star
72

pysurvival

Open source package for Survival Analysis modeling
HTML
319
star
73

pylink

Python Library for device debugging/programming via J-Link
Python
317
star
74

workflow-swift

A Swift and Kotlin library for making composable state machines, and UIs driven by those state machines.
Swift
302
star
75

rails-auth

Modular resource-based authentication and authorization for Rails/Rack
Ruby
288
star
76

cocoapods-generate

A CocoaPods plugin that allows you to easily generate a workspace from a podspec.
Ruby
272
star
77

inspect

inspect is a collection of metrics gathering, analysis utilities for various subsystems of linux, mysql and postgres.
Go
267
star
78

Aardvark

Aardvark is a library that makes it dead simple to create actionable bug reports.
Objective-C
257
star
79

jetpack

jet.pack: package your JRuby rack app for Jetty.
Ruby
249
star
80

gradle-dependencies-sorter

A CLI app and Gradle plugin to sort the dependencies in your Gradle build scripts
Kotlin
242
star
81

luhnybin

Shell
232
star
82

auto-value-redacted

An extension for Google's AutoValue that omits redacted fields from toString().
Java
211
star
83

protoparser

Java parser for .proto schema declarations.
Java
209
star
84

squalor

Go SQL utility library
Go
203
star
85

p2

Platypus Platform: Tools for Scalable Deployment
Go
196
star
86

mimecraft

Utility for creating RFC-compliant multipart and form-encoded HTTP request bodies.
Java
195
star
87

Listable

Declarative list views for iOS apps.
Swift
189
star
88

git-fastclone

git clone --recursive on steroids
Ruby
185
star
89

zapp

Continuous Integration for KIF
Objective-C
179
star
90

metrics

Metrics Query Engine
Go
170
star
91

ruby-rrule

RRULE expansion for Ruby
Ruby
168
star
92

quotaservice

The purpose of a quota service is to prevent cascading failures in micro-service environments. The service acts as a traffic cop, slowing down traffic where necessary to prevent overloading services. For this to work, remote procedure calls (RPCs) between services consult the quota service before making a call. The service isnโ€™t strictly for RPCs between services, and can even be used to apply quotas to database calls, for example.
Go
154
star
93

wire-gradle-plugin

A Gradle plugin for generating Java code for your protocol buffer definitions with Wire.
Groovy
153
star
94

goprotowrap

A package-at-a-time wrapper for protoc, for generating Go protobuf code.
Go
148
star
95

beancounter

Utility to audit the balance of Hierarchical Deterministic (HD) wallets. Supports multisig + segwit wallets.
Go
143
star
96

womeng_handbook

Everything you need to start or expand a women in engineering group in your community.
129
star
97

cocoapods-check

A CocoaPods plugin that shows differences between locked and installed Pods
Ruby
126
star
98

rce-agent

gRPC-based Remote Command Execution Agent
Go
125
star
99

spincycle

Automate and expose complex infrastructure tasks to teams and services.
Go
118
star
100

in-app-payments-react-native-plugin

Objective-C
116
star