Journey with me as I diagnose and solve a perplexing iOS 8 regression where rotation occurs despite interface configurations explicitly prohibiting it. Through careful analysis of UIKit's decompiled code across iOS 7.1 and 8.1, I uncover how Apple's changes to UIWindow rotation handling break apps using multiple windows. This technical deep-dive reveals the core problem and presents a practical workaround that hides the rootViewController during window transitions to bypass the rotation issue without affecting iOS 7 compatibility.
Discover hidden debugging features in UIKit that Apple engineers use internally to troubleshoot UI issues. I explain how to enable the secret UIPopoverControllerPaintsTargetRect setting and bypass Apple's InternalBuild checks using runtime tricks with Aspects and Facebook's fishhook. Learn how to access a wealth of internal debug flags that provide detailed logging for touches, gestures, animations, and more. This post includes practical code examples and implementation details for accessing these powerful hidden tools.
Learn how to elegantly backport iOS 8's convenient NSString containsString: method to iOS 7 with minimal code and maximum compatibility. I present a clean implementation that uses the Objective-C runtime to conditionally add this method only on iOS 7 devices, ensuring it won't conflict with Apple's native implementation on newer systems. This technique demonstrates how to safely extend foundation classes with future APIs while maintaining forward compatibility, using function attributes to optimize compilation when targeting newer iOS versions.
Dive into the intricacies of method swizzling in Objective-C as I troubleshoot a mysterious crash that occurs when my Aspects library interacts with New Relic's SDK. I explore how UIKit's touch forwarding system relies on the _cmd parameter, which traditional swizzling breaks by changing selector references. Through detailed analysis of the iOS runtime's touch handling mechanisms, I demonstrate a better swizzling approach that preserves _cmd integrity. This technical deep-dive includes disassembly of UIKit's forwardTouchMethod function and practical code examples for safer method replacement.
Join me as I explore practical uses for Aspects, my open-source library for aspect-oriented programming in Objective-C. In this article, I investigate how Apple implements the iOS 6 iPad restriction that forces UIImagePickerController to be presented via a popover. Through runtime analysis with Hopper, I uncover Apple's view hierarchy traversal technique for popover detection and demonstrate how to use Aspects to bypass this restriction safely. This behind-the-scenes look reveals how UIKit works internally and showcases the power of runtime inspection for debugging and hacking.
Discover how I tackled the notoriously buggy UITextView in iOS 7 which suffered from severe scrolling and content positioning issues when using contentInset. I walk through the creation of PSPDFTextView, a drop-in replacement that fixes multiple scrolling problems including caret position tracking, proper handling of new lines, and content inset awareness. This solution arose from community collaboration after Apple failed to address these critical bugs even in iOS 7.1 beta releases.
Follow along as I tackle an annoying UI glitch in iOS 7's printer controller where the label is offset and looks misaligned. Through runtime inspection with Reveal and class swizzling, I implement a quick fix for the UIPrinterSearchingView that centers the label properly. This practical example demonstrates how to patch Apple's oversights in UIKit while writing defensive code that won't break when Apple eventually fixes the issue.
Unlock the secrets of iOS app design by exploring the view hierarchies of third-party applications with this step-by-step guide. Using a jailbroken device, learn how to configure debugging tools, inject code at runtime, and analyze an app's internal structure. I walk through setting up the necessary environment, creating custom debugging scripts, and extracting valuable insights from apps like Facebook and Flipboard. This technique offers a powerful learning opportunity for iOS developers seeking to understand how complex interfaces are implemented.
Tackle the frustrating visual glitches in UISearchDisplayController on iOS 7 with this comprehensive guide to fixing the broken animation, incorrect frame positioning, and status bar issues. I provide a detailed analysis of the underlying problems and share a complete, battle-tested solution implemented in PSPDFKit. Learn how to properly handle view hierarchy manipulations, status bar management, and frame calculations to create a polished search experience despite Apple's buggy implementation in the iOS 7.0 release.
Streamline your delegate pattern implementation in Objective-C with a clever proxy approach that eliminates repetitive boilerplate code. I present a complete solution that handles method forwarding, respects the respondsToSelector check, properly manages weak references to avoid retain cycles, and even supports block-based callbacks. This technique significantly reduces code verbosity while maintaining safety and readability, making delegate calls as simple as a direct message send.