Break Objective-C Block Retain Cycles With __weak and __strong
Capture self weakly in blocks and promote it strongly inside to avoid retain cycles under ARC.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Capture self weakly in blocks and promote it strongly inside to avoid retain cycles under ARC.
ARC doesn't prevent every leak. Learn how strong block captures create retain cycles and how weak self breaks them.
Learn how ARC works, spot common retain‑cycle pitfalls, and break them with weak references. A practical delegate example, block handling, and a checklist keep your Objective‑C code leak‑free.
A practical guide to Objective‑C ARC weak references: how they prevent retain cycles, a worked delegate/block example, common pitfalls, and verification steps using Xcode breakpoints and Instruments.
Learn how to use Objective-C Categories to extend classes and system frameworks without subclassing, including a practical example and critical memory limits.
Wrap Objective-C public headers in NS_ASSUME_NONNULL regions and mark exceptions with nullable to get compile-time checks and correct Swift optional types.
View controllers that never deallocate after dismissal usually mean a retain cycle with a block. This guide maps symptoms to causes and gives ordered checks and fixes for ARC in Objective-C.
Learn how to attach arbitrary data to existing Objective‑C instances without subclassing or source changes. This guide walks through the desired outcome, prerequisites, step‑by‑step use of objc_setAssociatedObject, safety checks, and cleanup options.
ARC handles retain/release for you, but ownership qualifiers are still your decision. A practical rule for __weak vs __strong, a safe delegate example, the weak-strong dance for blocks, and how to verify with Instruments.