Re: Tracking down source of [_NSControllerObjectProxy copyWithZone:]… error

2015-09-21 Thread Greg Parker

> On Sep 19, 2015, at 8:09 PM, Alex Hall  wrote:
> 
> Hey list,
> A binding is driving my app (my actual one, not the test one) and has been 
> for days now--awesome! Amid more refactoring of my code, and adding a second 
> binding which didn't take because of uninitialized properties, I've now 
> started seeing this error in my debug log:
> 
> [_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to 
> instance 0x60800ae0
> 
> failed to set (contentViewController) user defined inspected property on 
> (NSWindow): -[_NSControllerObjectProxy copyWithZone:]: unrecognized selector 
> sent to instance 0x60800ae0
> 
> From what I've been reading, this is due to something trying to copy an 
> object that doesn't conform to the NSCopy protocol. Most likely, I have a 
> proxy object somewhere Cocoa expects an instance, and since the proxy can't 
> be copied, this is happening. The problem is, I can't see *where* this is 
> going on. My debug log is showing me this, but my debug navigator is empty. 
> There's no runtime error showing in a source file like there is when the line 
> causing the problem is clear, and since I only have an address for the 
> instance and not a name, I'm at a bit of a loss. What is a good strategy for 
> discovering the source of this problem so I can fix it?

This is probably failing to crash because "unrecognized selector" throws an 
exception and the exception is being caught and ignored somewhere.

If you can reproduce this yourself, try running with an Exceptions breakpoint 
set. That should stop in the debugger with the call site in the stack trace. 
(Breakpoints navigator > "+" button at the bottom > Add Exception Breakpoint)

Another dumb alternative: implement -[_NSControllerObjectProxy copyWithZone:] 
to call abort() or otherwise halt the process. Then it will stop in the 
debugger or generate a crash log with a stack trace pointing to the call site.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Tracking down source of [_NSControllerObjectProxy copyWithZone:]… error

2015-09-20 Thread Alex Hall

> On Sep 20, 2015, at 02:04, Quincey Morris 
>  wrote:
> 
> On Sep 19, 2015, at 20:09 , Alex Hall  > wrote:
>> 
>> [_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to 
>> instance 0x60800ae0
>> 
>> failed to set (contentViewController) user defined inspected property on 
>> (NSWindow): -[_NSControllerObjectProxy copyWithZone:]: unrecognized selector 
>> sent to instance 0x60800ae0
> 
> 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
mehg...@icloud.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Tracking down source of [_NSControllerObjectProxy copyWithZone:]… error

2015-09-20 Thread Mike Abdullah

> On 20 Sep 2015, at 07:04, Quincey Morris 
>  wrote:
> 
> On Sep 19, 2015, at 20:09 , Alex Hall  wrote:
>> 
>> [_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to 
>> instance 0x60800ae0
>> 
>> failed to set (contentViewController) user defined inspected property on 
>> (NSWindow): -[_NSControllerObjectProxy copyWithZone:]: unrecognized selector 
>> sent to instance 0x60800ae0
> 
> 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).
> 
> This could be a memory management error (the original object has been 
> deallocated, and the memory re-used for another object)

Almost certainly this. Try running with zombies on.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Tracking down source of [_NSControllerObjectProxy copyWithZone:]… error

2015-09-19 Thread Quincey Morris
On Sep 19, 2015, at 20:09 , Alex Hall  wrote:
> 
> [_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to 
> instance 0x60800ae0
> 
> failed to set (contentViewController) user defined inspected property on 
> (NSWindow): -[_NSControllerObjectProxy copyWithZone:]: unrecognized selector 
> sent to instance 0x60800ae0

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).

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.

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.)

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Tracking down source of [_NSControllerObjectProxy copyWithZone:]… error

2015-09-19 Thread Alex Hall
Hey list,
A binding is driving my app (my actual one, not the test one) and has been for 
days now--awesome! Amid more refactoring of my code, and adding a second 
binding which didn't take because of uninitialized properties, I've now started 
seeing this error in my debug log:

[_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to 
instance 0x60800ae0

failed to set (contentViewController) user defined inspected property on 
(NSWindow): -[_NSControllerObjectProxy copyWithZone:]: unrecognized selector 
sent to instance 0x60800ae0

From what I've been reading, this is due to something trying to copy an object 
that doesn't conform to the NSCopy protocol. Most likely, I have a proxy object 
somewhere Cocoa expects an instance, and since the proxy can't be copied, this 
is happening. The problem is, I can't see *where* this is going on. My debug 
log is showing me this, but my debug navigator is empty. There's no runtime 
error showing in a source file like there is when the line causing the problem 
is clear, and since I only have an address for the instance and not a name, I'm 
at a bit of a loss. What is a good strategy for discovering the source of this 
problem so I can fix it?

In case this affects things, I'm seeing the following at the very top of my 
debug log:

Failed to connect (tweetTextField) outlet from (Cinnamon.ViewController) to 
(NSTextView): missing setter or instance variable

This is, I'm pretty sure, because tweetTextField is gotten via a computed 
property, pulling the documentView out of a scroll view; as it says, I have no 
setter. This setup was working before I managed to cause the afore mentioned 
copying problem, though, so I doubt this is related. Better too much detail 
than not enough, though. My declaration for this is:

@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
}
}


Anyway, any suggestions on how to hunt down the cause of this copying bug would 
be appreciated. Thanks everyone!

--
Have a great day,
Alex Hall
mehg...@icloud.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: copyWithZone error

2008-04-05 Thread Cathy Shive

Hi Nick,

When you return your item to the table column, I believe this is  
setting the cell's object value to this item.  The object value of an  
NSCell needs to conform to the NSCopyingProtocol.

If you implement the method:

- (id)copyWithZone:(NSZone *)zone

in HDIR to return a copy of the object, you won't get this error  
anymore.


Best,
Cathy


On Apr 5, 2008, at 10:25 AM, Nick Rogers wrote:


Hi,
when i return the item for a tableColumn in NSOutlineView, the  
following error is there:


*** -[HDIR copyWithZone:]: selector not recognized [self = 0x39b670]

Here HDIR is the item that i return for a particular tableColumn of  
outline view.

HDIR also inherits from NSObject.

WIshes,
Nick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


copyWithZone error

2008-04-05 Thread Nick Rogers

Hi,
when i return the item for a tableColumn in NSOutlineView, the  
following error is there:


*** -[HDIR copyWithZone:]: selector not recognized [self = 0x39b670]

Here HDIR is the item that i return for a particular tableColumn of  
outline view.

HDIR also inherits from NSObject.

WIshes,
Nick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]