Mobile Development 10 min read

Lens System: An Integrated Debugging Toolkit for iOS Mobile Development

Lens is an integrated iOS debugging toolkit that adds a floating window with plug‑in modules—such as view inspection, real‑time network error alerts, simulated memory warnings, DNS spoofing, FPS monitoring, measurement tools, and configurable switches—to streamline development, testing, design, and product management, boosting team efficiency and reducing production incidents.

iQIYI Technical Product Team
iQIYI Technical Product Team
iQIYI Technical Product Team
Lens System: An Integrated Debugging Toolkit for iOS Mobile Development

Background – Mobile client product development typically involves four main roles: developers, testers, designers, and product managers. During iterative development, each version brings repetitive tasks and recurring problems that hinder efficiency, such as locating code, switching test environments, or identifying whether an issue originates from the front‑end or back‑end.

Purpose – The Lens system was created to lower the cost of improving the efficiency of the entire mobile team, enable rapid problem discovery, reduce error rates, and minimize production incidents.

Overview – Lens is a set of tools integrated into an iOS app in debug mode. It provides a unified entry point (a floating UIWindow) that offers services for all team roles. It incorporates useful features from open‑source projects like Flex and DoraemonKit, with business‑specific optimizations.

Features and Principles – Lens organizes functionalities into plug‑in groups that can be registered or removed dynamically. The main features include:

View Inspection – Quickly obtain basic and extended information about the selected view and its parent hierarchy. Compared with Flex and Lookin, Lens captures only the data of interest, making it faster and more precise.

Example output shows class name, image name, size, background color, etc. The underlying principle is to traverse the window hierarchy from the selected point, collect information from each view in the response chain, and display it. Custom data can be added by implementing a protocol such as:

- (NSAttributedString *Nullable)qyDebugCheckViewInfoForView:(UIView *Nullable)view;

Real‑time Network Error Monitoring – When a network request fails, Lens’s floating window raises an alarm and logs the error. Users can open the network log to see failure time, URL, and server response, helping developers and testers locate issues quickly.

Principle: Hook the network layer’s failure callback, record details to a local log, and trigger a UI alarm.

Simulated Memory Warning – Uses a private API to simulate memory warnings on a real device, allowing developers to test memory‑related edge cases without affecting App Store submission.

DNS Spoofing – Provides a simple, “fool‑proof” way to redirect URLs to a test environment (e.g., mapping Test.a.com to 10.10.10.10 ) without requiring Charles or other high‑threshold tools. The implementation relies on method swizzling of NSURL to replace the host when a match is detected.

FPS Display – Uses CADisplayLink to monitor the current frame rate, helping identify UI jank in real time.

Measurement Tool & Color Picker – Allows users to pick two points on the screen to measure rectangle dimensions and to sample pixel colors from a screenshot, similar to features in DoraemonKit.

Switch Group – A set of business‑related toggles that force the app to follow alternative logic branches, useful for testing different configurations without changing code.

Modifiable Items Group – Similar to switches but allows editing of values (e.g., user ID) to test various scenarios.

Disable Functionality – Provides a global switch to turn off the entire Lens toolkit when its presence interferes with normal app behavior.

Summary – Lens aims to achieve maximum output with minimal investment, focusing on high‑value features and ease of use. Its plug‑in architecture enables rapid integration and removal, catering to diverse team and business needs.

Future Plans – Upcoming enhancements include internal leak detection, full network request inspection, crash‑log export, and a PC‑based integration tool, among others.

debuggingMobile DevelopmentiOSperformance monitoringnetwork analysistoolkitUI inspection
iQIYI Technical Product Team
Written by

iQIYI Technical Product Team

The technical product team of iQIYI

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.