I turned on a new flag in xcode and get the warning “Weak receiver may be unpredictably null in ARC mode”. This confuses me because OF COURSE it could be nil.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I asked this question a week ago and received no answer, but Greg Parker answered it on the mailing list. So I am reposting with the answer.
In my first incarnation of this question, I posted something like this, where I thought testing for nil should have been enough
The problem is that self.rootViewController could BECOME nill in the space between checking for nil and completing the method called. What we are told to do is to assign to a strong local reference and use that like so
Stephen Butler presented succinct restatement of the problem this warning is meant to combat