Re: Tracking down source of [_NSControllerObjectProxy copyWithZone:]… error
Re: Tracking down source of [_NSControllerObjectProxy copyWithZone:]… error
- Subject: Re: Tracking down source of [_NSControllerObjectProxy copyWithZone:]… error
- From: Alex Hall <email@hidden>
- Date: Sun, 20 Sep 2015 08:02:12 -0400
> On Sep 20, 2015, at 02:04, Quincey Morris <email@hidden> wrote:
>
> On Sep 19, 2015, at 20:09 , Alex Hall <email@hidden <mailto:email@hidden>> wrote:
>>
>> [_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to instance 0x608000000ae0
>>
>> failed to set (contentViewController) user defined inspected property on (NSWindow): -[_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to instance 0x608000000ae0
>
> I dunno, the things mentioned in the message don’t really go together. “contentViewController” is a property of a NSWindowController, not a NSWindow, and its value ought to be a NSViewController, not anything related to a NSController (which is something entirely different, in spite of the similar name).
You're right, that *is* weird. I didn't pick up on that while reading the errors, and I'm not sure why that might be happening. I did add an NSController (that's the second binding I mentioned), and its only connection was to a label inside a scroll view. As soon as I removed that connection, I got 0 errors. At least I have the source of the problem now and can work with that controller to figure out why it happened. How it got bound to the window I have no idea, because no such connection was in the inspector, only one to that label.
>
> This could be a memory management error (the original object has been deallocated, and the memory re-used for another object), an invalid connection in the storyboard, or just a misleading message. Or any combination of those.
>
>> Failed to connect (tweetTextField) outlet from (Cinnamon.ViewController) to (NSTextView): missing setter or instance variable
>
>> @IBOutlet weak var tweetScrollView:NSScrollView!
>> var tweetTextField:NSTextView { //all we need here is the text view inside the scroll view
>> get {
>> return tweetScrollView.contentView.documentView as! NSTextView
>> }
>> }
>
> It kinda looks like you once had tweetTextField set up as an outlet, then changed it to a normal property. If it was actually connected in the storyboard when you changed it, IB would remember the name, and that it used to represent an outlet. (IB tries not to throw away connections you previously made, in case they’re only temporarily missing from the source.) This is harmless if the source property is really gone, but I’d guess that IB sees it’s come back again, and is therefore trying to make the connection at run time — and of course it can’t without a setter or a non-computed property.
>
> The solution would be to find the connection in the IB inspector and manually disconnect it. At that point, the outlet should disappear from IB completely.
Yes, it did disappear. I never realized the Connections Inspector shows all connections if you highlight a scene, that's good to know. I'd been using the ruler of my view controller, since that's where I make connections from anyway. I know this seems a difficult feature to not notice, but it's not at all obvious what an inspector is doing when you're using VoiceOver as it takes at least seven keystrokes just to get to the Inspector from the storyboard, so I don't do it if I don't have to.
Yes, I'd originally had tweetTextField as an outlet bound to a text field, but changed it when I switched to a textView instead. The old connection was indeed still there, but as far as I could tell, there was no mention of any warning about anything wrong. It'd be awesome if Xcode could put that in the scene in he outline table, something like "my view scene, has 1 invalid connection". I'll file an enhancement request.
>
> Incidentally, this would be another bug to report, possibly two. The first bug is that IB didn’t realize it’s not really an outlet any more. The second is that IB marks invalid outlets with a little exclamation point icon, and I suspect this is very hard or impossible to detect via VO. (Even if the accessibility information tells you that it’s so marked, you’d have to check each outlet individually to find out. If you can see the inspector, a single glance tells you if there are any invalid outlets.)
--
Have a great day,
Alex Hall
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden