Boon
Boon

Reputation: 41480

Debug console not showing values for Swift + Objective-C

My app uses Swift and a 3rd-party library in Objective-C. When my debugger steps into the Objective-C code, the debug console does not show the values of my Swift string correctly. Instead, it shows unable to read data. How can we resolve this issue?

enter image description here

Upvotes: 13

Views: 840

Answers (3)

Ali ZahediGol
Ali ZahediGol

Reputation: 1096

you can use po {{variable_name}} on lldb for print runtime value and also use e {{variable_name}} for print and e {{variable_name}} = {{value}} for set new value.

attention: when you use po autocomplete work, but when use e autocomplete doesn't work.

Upvotes: 0

Uddiptta Ujjawal
Uddiptta Ujjawal

Reputation: 58

I suppose you might be using objective C bridging header also to use objective c library in Swift. I see both email and password is shown as Swift._NSContiguousString.And that may be the case if the bridging header that you made for your library might be giving some problem or not executing properly ,not sure. Because if the bridging was working then Swift._NSContiguousString would have been treated as "NSString" and you could convert it to as "String" simply.This is what I think ,you can jus check on the bridging header.

Upvotes: 0

Kotha Sai Ram
Kotha Sai Ram

Reputation: 83

If you are using xcode 7.3 you can debug swift classes but xcode less than 7.3 you can debug for objective c class. Both swift and objective c support is not there. You can copy paste those objective c variables and you can print objective c variables by "po objectiveC_variable".

Upvotes: 3

Related Questions