Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 327
Mikael Avatar asked Apr 21 '16 02:04

Mikael


2 Answers

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.

like image 157
Lee Fastenau Avatar answered Oct 12 '22 23:10

Lee Fastenau


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

like image 45
Jim Ingham Avatar answered Oct 12 '22 23:10

Jim Ingham