Getting error message "Unknown type name '_weak'"


#1

I am working through chapter 3, and when typing the code from pg. 70:
_weak BNRItem *container;
I get 2 errors on this line.

  1. Expected ‘:’ at end of declaration list
  2. Unknown type name '_weak’
    And the code will not compile.

The code worked properly up to this point. Upon consulting the documentation, it appears to indicate that “weak” is no longer supported, and ‘assign’ should be used, but I am unable to find additional details in the iOS Documentation. I would like to understand what is happening before moving on.
I am using xCode 4.3.3.

Thanks for any assistance.


#2

FYI, I finally found the solution in the documentation under “Transitioning to ARC Release Notes”.

The syntax as listed in the book:
_weak BNRItem *container;
is no longer correct, the new syntax (which works in my code) is:
BNRItem *_weak_container;


#3

That doesn’t sound right. The syntax in the book is still correct. Are you sure you were using two underscores? __weak BNRItem *container;