{"id":1071,"url":"https://github.com/square/PonyDebugger","last_synced_at":"2025-07-30T20:31:15.179Z","repository":{"id":4363486,"uuid":"5499847","full_name":"square/PonyDebugger","owner":"square","description":"Remote network and data debugging for your native iOS app using Chrome Developer Tools","archived":false,"fork":false,"pushed_at":"2023-03-18T22:52:48.000Z","size":2327,"stargazers_count":5862,"open_issues_count":45,"forks_count":595,"subscribers_count":293,"default_branch":"master","last_synced_at":"2024-10-29T14:59:50.550Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/square.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"Contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-08-21T19:25:40.000Z","updated_at":"2024-10-28T18:51:26.000Z","dependencies_parsed_at":"2023-07-05T19:18:06.328Z","dependency_job_id":null,"html_url":"https://github.com/square/PonyDebugger","commit_stats":{"total_commits":224,"total_committers":39,"mean_commits":5.743589743589744,"dds":0.7410714285714286,"last_synced_commit":"3e5ba266d091f421df843984e967965535aecc60"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2FPonyDebugger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2FPonyDebugger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2FPonyDebugger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2FPonyDebugger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/square","download_url":"https://codeload.github.com/square/PonyDebugger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226564099,"owners_count":17652077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:38.289Z","updated_at":"2024-12-04T19:32:52.337Z","avatar_url":"https://github.com/square.png","language":"Objective-C","readme":"![PonyDebugger Logo](https://github.com/square/PonyDebugger/raw/master/Documentation/Images/Logo.png)\n\nPonyDebugger\n============\n[![CI Status](https://travis-ci.org/square/PonyDebugger.svg?branch=master)](https://travis-ci.org/square/PonyDebugger)\n[![Version](https://img.shields.io/cocoapods/v/PonyDebugger.svg)](http://cocoadocs.org/docsets/PonyDebugger)\n[![License](https://img.shields.io/cocoapods/l/PonyDebugger.svg)](http://cocoadocs.org/docsets/PonyDebugger)\n[![Platform](https://img.shields.io/cocoapods/p/PonyDebugger.svg)](http://cocoadocs.org/docsets/PonyDebugger)\n\nPonyDebugger is a remote debugging toolset.  It is a client library and gateway\nserver combination that uses Chrome Developer Tools on your browser to debug\nyour application's network traffic and managed object contexts.\n\nTo use PonyDebugger, you must implement the client in your application and\nconnect it to the gateway server. There is currently an iOS client and the\ngateway server.\n\nPonyDebugger is licensed under the Apache Licence, Version 2.0\n(http://www.apache.org/licenses/LICENSE-2.0.html).\n\nChanges\n-------\n\n### v0.4.0 - 2014-08-15\n\n - Support `NSURLSession` requests for the Network Debugger. (@viteinfinite)\n - New test application that removes the AFNetworking dependency.\n   (@viteinfinite)\n - Remove custom base64 implementation with Apple's built-in implementation.\n   (@kyleve)\n - Add PodSpec for pulling the git repository directly. (@wlue)\n\n### v0.3.1 - 2014-01-02\n\n - Fix only building active arch in debug. (@kyleve)\n - Fix view hierarchy debugging with complex key paths. (@ryanolsonk)\n - Fix crash in swizzled exchangeSubviewAtIndex:withSubviewAtIndex:\n   (@ryanolsonk)\n - Fix for crash when having a library that looks like a NSURLConnectionDelegate\n   (@peterwilli)\n\n### v0.3.0 - 2013-05-01\n\n - Remote Logging and Introspection (@wlue)\n - Request response pretty printing in Network Debugger (@davidapgar)\n - Minor bug fixes and improvements. (@jerryhjones, @conradev, @ryanolsonk)\n\n### v0.2.1-beta1 - 2013-01-12\n\n - Bonjour support (@jeanregisser)\n - Memory leak fix (@rwickliffe)\n\nFeatures\n--------\n\n### Network Traffic Debugging\n\nPonyDebugger sends your application's network traffic through\n[ponyd](https://github.com/square/PonyDebugger/tree/master/ponyd),\nPonyDebugger's proxy server.  You use Inspector's Network tools to debug network\ntraffic like how you would debug network traffic on a website in Google Chrome.\n\n![PonyDebugger Network Debugging Screenshot](https://github.com/square/PonyDebugger/raw/master/Documentation/Images/NetworkDebugging.png)\n\nPonyDebugger forwards network traffic, and does not sniff network traffic. This\nmeans that traffic sent over a secure protocol (https) is debuggable.\n\nCurrently, the iOS client automatically proxies data that is sent via\n`NSURLConnection` and `NSURLSession` methods. This means that it will\nautomatically work with AFNetworking, and other libraries that use\n`NSURLConnection` or `NSURLSession` for network requests.\n\n### Core Data Browser\n\nThe Core Data browsing feature allows you to register your application's\n`NSManagedObjectContext`s and browse all of its entities and managed objects.\nYou browse data from the IndexedDB section in the Resource tab in Chrome\nDeveloper Tools.\n\n![PonyDebugger Core Data Browser Screenshot](https://github.com/square/PonyDebugger/raw/master/Documentation/Images/CoreDataBrowser.png)\n\nThese are read-only stores at the moment.  There are plans to implement data\nmutation in a future release.\n\n### View Hierarchy Debugging\n\nPonyDebugger displays your application's view hierarchy in the Elements tab of\nthe Chrome Developer Tools. As you move through the XML tree, the corresponding\nviews are highlighted in your app. You can edit the displayed attributes (i.e.\nframe, alpha, ...) straight from the Elements tab, and you can change which\nattributes to display by giving PonyDebugger an array of UIView key paths.\nDeleting a node in the elements panel will remove that node from the view\nhierarchy. Finally, when a view is highlighted, you can move it or resize it\nfrom the app using pan and pinch gestures.\n\n![PonyDebugger View Hierarchy Debugging Screenshot](https://github.com/square/PonyDebugger/raw/master/Documentation/Images/ViewHierarchyDebugging.png)\n\nAn \"inspect\" mode can be entered by clicking on the magnifying glass in the\nlower left corner of the Developer Tools window. In this mode, tapping on a view\nin the iOS app will select the corresponding node in the elements panel. You can\nalso hold and drag your finger around to see the different views highlighted.\nWhen you lift your finger, the highlighted view will be selected in the elements\npanel.\n\nCurrently only a subset of the actions possible from the elements panel have\nbeen implemented. There is significant room for continued work and improvement,\nbut the current functionality should prove useful nonetheless.\n\n### Remote Logging\n\nPonyDebugger lets you remotely log text and object dumps via the `PDLog` and\n`PDLogObjects` function. This lets you reduce the amount of content being\nlogged in `NSLog`, while also allowing you to dynamically introspect objects.\n\n![PonyDebugger Remote Login Screenshot](https://github.com/square/PonyDebugger/raw/master/Documentation/Images/RemoteLogging.png)\n\nIntrospected objects can be expanded recursively by property. This means that\nyou don't have to breakpoint and log in GDB or LLDB to introspect an object.\n\nQuick Start\n-----------\nPrerequisite: Xcode's Command Line Tools must be installed from the \"Downloads\"\npreference pane.\n\n```sh\n\ncurl -s https://cloud.github.com/downloads/square/PonyDebugger/bootstrap-ponyd.py | \\\n  python - --ponyd-symlink=/usr/local/bin/ponyd ~/Library/PonyDebugger\n```\n\nThis will install `ponyd` script to `~/Library/PonyDebugger/bin/ponyd` and\nattempt to symlink `/usr/local/bin/ponyd` to it. It will also download the\nlatest chrome dev tools source.\n\nThen start the PonyDebugger gateway server\n\n```sh\nponyd serve --listen-interface=127.0.0.1\n```\n\nIn your browser, navigate to `http://localhost:9000`. You should see the\nPonyGateway lobby. Now you need to integrate the client to your application.\n\nFor more detailed instructions, check out the gateway server\n[README_ponyd](https://github.com/square/PonyDebugger/blob/master/README_ponyd.rst).\n\nPonyDebugger iOS Client\n=======================\n\nThe PonyDebugger iOS client lets you to debug your application's network\nrequests and track your managed object contexts.\n\n#### Technical\n\n- Requires iOS 5.0 or above\n- Uses ARC (Automatic Reference Counting).\n- Uses SocketRocket as a WebSocket client.\n\nInstalling\n----------\n\n#### CocoaPods\n\n[CocoaPods](http://cocoapods.org/) automates 3rd party dependencies in\nObjective-C.\n\nInstall the ruby gem.\n\n    $ sudo gem install cocoapods\n    $ pod setup\n\n\u003e Depending on your Ruby installation, you may not have to run as sudo to\n\u003e install the cocoapods gem.\n\nCreate a Podfile. You must be running on iOS 5 or above.\n\n    platform :ios, '5.0'\n    pod 'PonyDebugger', '~\u003e 0.4.3'\n\nIf you would like to use the latest version of PonyDebugger, point to the Github\nrepository directly.\n\n    pod 'PonyDebugger', :git =\u003e 'https://github.com/square/PonyDebugger.git'\n\nInstall dependencies.\n\n    $ pod install\n\nWhen using CocoaPods, you must open the `.xcworkspace` file instead of the\nproject file when building your project.\n\n#### Manual Installation\n\n- Extract a tarball or zipball of the repository into your project directory.\n  If you prefer, you may also add the project as a submodule.  The iOS client\n  uses [SocketRocket](https://github.com/square/SocketRocket) as a dependency,\n  and it is included as a submodule.\n\n```\ncd /path/to/YourApplication\nmkdir Frameworks\ngit submodule add git://github.com/square/PonyDebugger.git Frameworks/PonyDebugger\ngit submodule update --init --recursive\n```\n\n- Add `PonyDebugger/PonyDebugger.xcodeproj` as a subproject.\n\n![PonyDebugger Installing Subproject](https://github.com/square/PonyDebugger/raw/master/Documentation/Images/Installing_Subproject.png)\n\n- In your Project Settings, add the PonyDebugger target as a Target Dependency\n  in the Build Phases tab.\n\n![PonyDebugger Installing Target Dependencies](https://github.com/square/PonyDebugger/raw/master/Documentation/Images/Installing_TargetDependencies.png)\n\n- Link `libPonyDebugger.a`, `libSocketRocket.a`, and the Framework dependencies\n  to your project.\n\n![PonyDebugger Installing Link Libraries and Frameworks](https://github.com/square/PonyDebugger/raw/master/Documentation/Images/Installing_LinkLibraries.png)\n\n- PonyDebugger and SocketRocket take advantage of Objective C's ability to add\n  categories on an object, but this isn't enabled for static libraries by\n  default. To enable this, add the `-ObjC` flag to the \"Other Linker Flags\"\n  build setting.\n\n![PonyDebugger Installing Other Linker Flags](https://github.com/square/PonyDebugger/raw/master/Documentation/Images/Installing_OtherLinkerFlags.png)\n\n#### Framework Dependencies\n\nYour .app must be linked against the following frameworks/dylibs in addition to\n`libPonyDebugger.a` and `libSocketRocket.a`.\n\n- libicucore.dylib\n- CFNetwork.framework\n- CoreData.framework\n- Security.framework\n- Foundation.framework\n\nUsage\n-----\n\nPonyDebugger's main entry points exist in the `PDDebugger` singleton.\n\n``` objective-c\nPDDebugger *debugger = [PDDebugger defaultInstance];\n```\n\nTo connect automatically to the PonyGateway on your LAN (via Bonjour):\n\n``` objective-c\n[debugger autoConnect];\n```\n\nOr to open the connection to a specific host, for instance\n`ws://localhost:9000/device`:\n\n``` objective-c\n[debugger connectToURL:[NSURL URLWithString:@\"ws://localhost:9000/device\"]];\n```\n\nTo manually close the connection:\n\n``` objective-c\n[debugger disconnect];\n```\n\n### Network Traffic Debugging\n\nTo enable network debugging:\n\n``` objective-c\n[debugger enableNetworkTrafficDebugging];\n```\n\nPonyDebugger inspects network data by injecting logic into\n`NSURLConnectionDelegate` classes. If you want PonyDebugger to automatically\nfind these classes for you:\n\n``` objective-c\n[debugger forwardAllNetworkTraffic];\n```\n\nThis will swizzle methods from private APIs, so you should ensure that this only\ngets invoked in debug builds. To manually specify delegate classes:\n\n``` objective-c\n[debugger forwardNetworkTrafficFromDelegateClass:[MyClass class]];\n```\n\nThese methods should be invoked before the connection is opened.\n\n### Core Data Browser\n\nPonyDebugger also allows you to browse your application's managed objects.\nFirst, enable Core Data debugging:\n\n``` objective-c\n[debugger enableCoreDataDebugging];\n```\n\nTo register a managed object context:\n\n``` objective-c\n[debugger addManagedObjectContext:self.managedObjectContext withName:@\"My MOC\"];\n```\n\n### View Hierarchy Debugging\n\nTo enable view hierarchy debugging:\n\n``` objective-c\n[debugger enableViewHierarchyDebugging];\n```\n\nPonyDebugger will inject logic into `UIView` add/remove methods to monitor\nchanges in the view hierarchy.\n\nYou can also set the attributes you want to see in the elements panel by passing\nan array of `UIView` key path strings\n\n``` objective-c\n[debugger setDisplayedViewAttributeKeyPaths:@[@\"frame\", @\"hidden\", @\"alpha\", @\"opaque\"]];\n```\n\nPonyDebugger uses KVO to monitor changes in the attributes of all views in the\nhierarchy, so the information in the elements panel stays fresh.\n\n### Remote Logging\n\nTo enable remote logging:\n\n``` objective-c\n[debugger enableRemoteLogging];\n```\n\nExample usage:\n\n``` objective-c\nPDLog(\"Hello world!\");               // This logs a simple string to the console output.\nPDLogObjects(self);                  // This logs an introspectable version of \"self\" to the console.\nPDLogObjects(\"My object:\", object);  // Combination of text and introspectable object.\n```\n\nThe repository contains a test application to demonstrate PonyDebugger's\ncapabilities and usage.\n\n### Known Issues / Improvements\n\n * `CoreData.framework` must be linked, even if you do not use the Core Data\n   browsing functionality.\n * iOS 5.1 and below: In certain cases,\n   `-[NSURLConnectionDataDelegate connection:willSendRequest:redirectResponse:]` \n   will never get called.  PonyDebugger requires this call to know when the\n   request was sent, and will warn you with a workaround that the timestamp is\n   inaccurate.\n\n   To fix the timestamp, make sure that `Accept-Encoding` HTTP header in your\n   `NSURLRequest` is not set (by default, iOS will set it to `gzip, deflate`,\n   which is usually adequate.\n\n   AFNetworking users: if you subclass `AFHTTPClient`, call\n   `[self setDefaultHeader:@\"Accept-Encoding\" value:nil];`.\n\n### Contributing\nWe’re glad you’re interested in PonyDebugger, and we’d love to see where you take it. Please read our [contributing guidelines](Contributing.md) prior to submitting a Pull Request.\n\nSome useful links:\n\n- [Chrome Remote Debugging Documentation](https://developer.chrome.com/devtools/docs/protocol/tot)\n- [WebKit Inspector Protocol Definition on GitHub](https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/inspector/protocol/Inspector.json)\n\n\n","funding_links":[],"categories":["Debugging","Objective-C","测试","IOS 或 OSX","Testing","HarmonyOS","Objective-C  Stars 1000以内排名整理","**Index**","Using DevTools frontend with other platforms"],"sub_categories":["Getting Started","Other free courses","Linter","Windows Manager","First, the gold standard libraries. The essentials --- You **NEED** to know about these !! You're likely to include a few of these in your own iOS projects","Browser Adapters"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2FPonyDebugger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquare%2FPonyDebugger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2FPonyDebugger/lists"}