Merry
Merry

Reputation: 460

How to access 'self' in Console in Xcode 7.3

I am not able to get dictionary/array value in console while debugging.

It always show message while po dictionary/array like

error: warning: Stopped in a context claiming to capture an Objective-C object pointer, but 'self' isn't available; pretending we are in a generic context

Check the screenshot here

Upvotes: 2

Views: 1093

Answers (4)

Muhammad Salman
Muhammad Salman

Reputation: 25

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

Source: "self" not available in debugger on iOS 5.1

Upvotes: 0

Vatsal K
Vatsal K

Reputation: 1051

You can check the values of properties and variables using po [self variablename] in console window. This way you can easily access the variables.

Also you can check with other projects weather the problem is with xcode or in your project configurations.

You can also expand the collapsed value in debug area. if it's expanding then you can access values by simply using po variablename otherwise you need to use po [self variablename].

enter image description here

Upvotes: 3

Balaji Ramakrishnan
Balaji Ramakrishnan

Reputation: 1949

I'd the same issue and found out this solution. Changing this clang module debugging DEBUG to NO and RELEASE to YES will solve your issue.

Checkout this link below.

Accessing Self in LLDB

Upvotes: 1

Tyson Vignesh
Tyson Vignesh

Reputation: 315

Please refer the following screen shot where i have printed the value of an array enter image description here

Upvotes: 0

Related Questions