“self” not available in debugger on iOS 5.1

后端 未结 3 551
别那么骄傲
别那么骄傲 2021-01-12 17:25

I\'m trying to debug a problem running under iOS 5.1 and when I stop in the debugger inside the code that gets the error and try to print something with the debugger I get t

相关标签:
3条回答
  • 2021-01-12 17:49

    In Build Settings, setting Precompile Prefix Header to NO fixed it for me.

    0 讨论(0)
  • 2021-01-12 17:51

    It was happening the same to me with Xcode 5 and iOS 6.1 development.

    I was compiling in Release mode, if someone has this problem again check that you compile on Debug mode.

    0 讨论(0)
  • 2021-01-12 17:59

    This is a debugger bug (Yeah, imagine that!)

    Simply restart XCode, and it shouldn't be a problem for you anymore :)

    EDIT:

    Psyche! I was thinking of something else.

    You're creating a retain cycle, and as of now, the debugger classifies this specific retain cycle this way (As I said, a bug).

    To fix this, create a weak copy of self:

    __weak __typeof(self)weakSelf = self;

    Then for the self that's giving you trouble:

    Change self.object to weakSelf.object

    0 讨论(0)
提交回复
热议问题