简体   繁体   中英

ios: self becomes nil in block?

I have a view controller, which calls several async network ops (I am using AFNetworking), and handles the response using blocks. Consistently - one of the blocks shows me that self == nil, but other blocks in the SAME view controller, using the same underlying AFNetworking client, show me that self != nil and behave as expected.

Why does this particular block gives me a nil self reference? Am I doing anything wrong? I tried googling for this symptom, in vain.

My View controller is compiled with ARC, testing on iOS 6.1 simulator...

Instead of accessing self directly, you should access it indirectly, from a reference that will not be retained. for more..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM