Mikael
Mikael

Reputation: 2395

Trying to print object description in Xcode produces an Error

I have an objective-C object that we can call ObjCObj I implemented a simple description method that usually works perfectly fine if I instanciate the class in a local variable.

The problem: I iterate through an array of ObjCObj objects and put them into a Swift Array

let cacheArray = [ObjCObj]()

After my array is filled, I try set a breakpoint, try to print the value of an Item and I get the following error:

expression produced error: 

/var/folders/w9/3rvg1bk95379dgvcr11n16_h0000gp/T/lldb/3499/expr878.swift:1:46: error: use of undeclared type '__ObjC'
$__lldb__DumpForDebugger(Swift.UnsafePointer<__ObjC.ObjCObj>(bitPattern: 0x67fd9b0).memory)

If I try to print an Expression like:

cacheArray[2]

It works. But If I open the array in the debugger inspector and choose one line of the array and ask for printing the description, it fails.

Upvotes: 12

Views: 1967

Answers (2)

Lee Fastenau
Lee Fastenau

Reputation: 444

I was getting the same error only moments ago and tracked it down to a bad property attribute in one of my Obj-C Mantle model classes. (Incorrectly treated an object as a scalar.)

Broken:

@property(nonatomic, assign, readonly, nullable) AdditionalInformationStatus *additionalInformationStatus;
                     ^^^^^^

Fixed:

@property(nonatomic, copy, readonly, nullable) AdditionalInformationStatus *additionalInformationStatus;
                     ^^^^

It was an easy fix, but tough to track down.

Upvotes: 3

Jim Ingham
Jim Ingham

Reputation: 27110

That sounds like a bug. Please file it at http://bugreporter.apple.com.

Upvotes: 1

Related Questions