2

I use AFNetworking in my project,but it have 2 warnings here: warning

full warning string is:

/AFNetworking/AFHTTPClient.m:575:38: Capturing 'operation' strongly in this block is likely to lead to a retain cycle

yellow
  • 702
  • 1
  • 10
  • 23
  • The problem is that your block will retain the operation object, which in turn retains the block, and thus they will never be released and you'll have a memory leak. Why are you assigning that inside there? you already have the `operation` object available – Ismael Dec 21 '12 at 14:32
  • it is one of `AFNetworking`'s files – yellow Dec 21 '12 at 15:50

1 Answers1

5

Here are two other questions with very good answers about this issue. This is an issue with using strong variables within blocks. To counteract this when using ARC you must use the __weak declaration. I recommend you read the first link especially to learn more.

EDIT

At first I didn't realize you were seeing this warning in AFNetworking's code. Using the most recent version of AFNetworking I do not see this warning.

Community
  • 1
  • 1
Keith Smiley
  • 54,143
  • 12
  • 89
  • 105