Re: Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Saagar Jha
Yup, this declares ImportTool (a subclass of NSObject) with the lightweight 
generic parameters X, Y, and Z. Here 

 are some examples and how they map to Swift, which makes the exact declaration 
syntax a bit more clear.

Regards,
Saagar Jha

> On Mar 28, 2019, at 18:49, Andy Lee  wrote:
> 
> The compiler may accept it, but it doesn't interpret it the way you think.  
> You can confirm by checking whether your class formally conforms to the 
> protocols.  Try this with your old code and your new code, and compare:
> 
> NSLog(@"conforms to protocol? %d", [ImportTool 
> conformsToProtocol:@protocol(NSTableViewDataSource)]);
> 
> I think Quincey is right, what you really did is declare a generic type.  
> It's a subtle mistake.  Notice that this also compiles:
> 
> @interface  ImportTool  : NSObject
> @end
> 
> --Andy
> 
> On Mar 28, 2019, at 7:44 PM, Peter Hudson  > wrote:
>> 
>> Very strange - the compiler is quite happy with my waywardness. 
>> Peter
>> 
>>> On 28 Mar 2019, at 23:39, Quincey Morris 
>>>  wrote:
>>> 
 On Mar 28, 2019, at 15:58 , Peter Hudson  wrote:
 
 @interface  ImportTool >>> NSEncoding> : NSObject
>>> 
>>> You’re Doing It Wrong™. You mean:
>>> 
 @interface  ImportTool : NSObject >>> NSTableViewDelegate, NSEncoding>
>>> 
>>> 
>>> I don’t know what it means the way you wrote it. Something about 
>>> lightweight generic syntax, perhaps?
>> 
>> ___
>> 
>> 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/aglee%40mac.com 
>> 
>> 
>> This email sent to ag...@mac.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/saagar%40saagarjha.com 
> 
> 
> This email sent to saa...@saagarjha.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: Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Andy Lee
The compiler may accept it, but it doesn't interpret it the way you think.  You 
can confirm by checking whether your class formally conforms to the protocols.  
Try this with your old code and your new code, and compare:

NSLog(@"conforms to protocol? %d", [ImportTool 
conformsToProtocol:@protocol(NSTableViewDataSource)]);

I think Quincey is right, what you really did is declare a generic type.  It's 
a subtle mistake.  Notice that this also compiles:

@interface  ImportTool  : NSObject
@end

--Andy

On Mar 28, 2019, at 7:44 PM, Peter Hudson  wrote:
> 
> Very strange - the compiler is quite happy with my waywardness. 
> Peter
> 
>> On 28 Mar 2019, at 23:39, Quincey Morris 
>>  wrote:
>> 
>>> On Mar 28, 2019, at 15:58 , Peter Hudson  wrote:
>>> 
>>> @interface  ImportTool >> NSEncoding> : NSObject
>> 
>> You’re Doing It Wrong™. You mean:
>> 
>>> @interface  ImportTool : NSObject >> NSTableViewDelegate, NSEncoding>
>> 
>> 
>> I don’t know what it means the way you wrote it. Something about lightweight 
>> generic syntax, perhaps?
> 
> ___
> 
> 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/aglee%40mac.com
> 
> This email sent to ag...@mac.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: Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Peter Hudson
Very strange - the compiler is quite happy with my waywardness. 
Peter

> On 28 Mar 2019, at 23:39, Quincey Morris 
>  wrote:
> 
>> On Mar 28, 2019, at 15:58 , Peter Hudson  wrote:
>> 
>> @interface  ImportTool > NSEncoding> : NSObject
> 
> You’re Doing It Wrong™. You mean:
> 
>> @interface  ImportTool : NSObject > NSTableViewDelegate, NSEncoding>
> 
> 
> I don’t know what it means the way you wrote it. Something about lightweight 
> generic syntax, perhaps?

___

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: Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Rob Petrovec
Yes, this.

—Rob


> On Mar 28, 2019, at 5:39 PM, Quincey Morris 
>  wrote:
> 
> On Mar 28, 2019, at 15:58 , Peter Hudson  wrote:
>> 
>> @interface  ImportTool > NSEncoding> : NSObject
> 
> You’re Doing It Wrong™. You mean:
> 
>> @interface  ImportTool : NSObject > NSTableViewDelegate, NSEncoding>
> 
> 
> I don’t know what it means the way you wrote it. Something about lightweight 
> generic syntax, perhaps? 
> ___
> 
> 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/petrock%40mac.com
> 
> This email sent to petr...@mac.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: Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Quincey Morris
On Mar 28, 2019, at 15:58 , Peter Hudson  wrote:
> 
> @interface  ImportTool  NSEncoding> : NSObject

You’re Doing It Wrong™. You mean:

> @interface  ImportTool : NSObject  NSTableViewDelegate, NSEncoding>


I don’t know what it means the way you wrote it. Something about lightweight 
generic syntax, perhaps?   
___

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: Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Peter Hudson
Hi Alex

After some thought i cast the object in question to (id) and the compiler was 
happy, and the program runs. 

Guess i need to read up on this aspect of the language. 

Peter

> On 28 Mar 2019, at 23:29, Alex Zavatone  wrote:
> 
> Not sure if this is a right answer, but what happens if you weakify the 
> instance?
> 
> Also, I suspect this is for MacOS, not iOS?
> 
> What happens if you try to recreate this in a simple case in a fresh project?
> 
> Alex Zavatone
> 
> Sent from my iPhone
> 
>> On Mar 28, 2019, at 5:58 PM, Peter Hudson  wrote:
>> 
>> Hi there
>> 
>> The class I am trying to use as a datasource and delegate to an NSTableView 
>> adopts the required protocols and implements the required methods  :- 
>> 
>> @interface  ImportTool > NSEncoding> : NSObject
>> 
>> etc …
>> 
>> 
>> But when I try to assign an instance of ImportScript as datasource and 
>> delegate to the table view in question I get the following warning :-
>> 
>> Assigning to 'id _Nullable' from incompatible type 
>> 'ImportTool *__strong’
>> 
>> 
>> Any suggestions gratefully received !
>> 
>> Peter
>> ___
>> 
>> 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/zav%40mac.com
>> 
>> This email sent to z...@mac.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: Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Alex Zavatone
Not sure if this is a right answer, but what happens if you weakify the 
instance?

Also, I suspect this is for MacOS, not iOS?

What happens if you try to recreate this in a simple case in a fresh project?

Alex Zavatone

Sent from my iPhone

> On Mar 28, 2019, at 5:58 PM, Peter Hudson  wrote:
> 
> Hi there
> 
> The class I am trying to use as a datasource and delegate to an NSTableView 
> adopts the required protocols and implements the required methods  :- 
> 
> @interface  ImportTool  NSEncoding> : NSObject
> 
> etc …
> 
> 
> But when I try to assign an instance of ImportScript as datasource and 
> delegate to the table view in question I get the following warning :-
> 
> Assigning to 'id _Nullable' from incompatible type 
> 'ImportTool *__strong’
> 
> 
> Any suggestions gratefully received !
> 
> Peter
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.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


Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Peter Hudson
Hi there

The class I am trying to use as a datasource and delegate to an NSTableView 
adopts the required protocols and implements the required methods  :- 

@interface  ImportTool  
: NSObject

etc …


But when I try to assign an instance of ImportScript as datasource and delegate 
to the table view in question I get the following warning :-

Assigning to 'id _Nullable' from incompatible type 
'ImportTool *__strong’


Any suggestions gratefully received !

Peter
___

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: NSManagedObject.managedObjectContext is nil???

2019-03-28 Thread Rick Mann
No, it wasn't deleted. It might've been refresh to re-fault everything.

> On Mar 28, 2019, at 10:13 , Steve Christensen  wrote:
> 
> Is it possible that the entity is retained but has been deleted from the MOC? 
> I vaguely recall seeing this myself at one point in the dim past.
> 
>> On Mar 27, 2019, at 1:18 PM, Rick Mann  wrote:
>> 
>> I can't tell. I don't believe I have any unreferenced MOCs.
>> 
>>> On Mar 27, 2019, at 13:08 , Dave Fernandes  
>>> wrote:
>>> 
>>> Just to clarify, the moc exists, but the reference to it is nil? Or has the 
>>> moc, itself, been deallocated?
>>> 
 On Mar 27, 2019, at 3:40 PM, Rick Mann  wrote:
 
 This is proving very hard to diagnose, as it doesn't always happen. I 
 tried observing -managedObjectContext, but it never gets called with a nil 
 value. Moreover, my entity's -dealloc method is sometimes called even 
 though none of the -awake methods gets called. This is a complex app with 
 a lot of async operation, so this entity gets created and destroyed often, 
 making it that much harder to figure out exactly what's going on.
 
 I can bulletproof the place where the crash occurs when the moc is nil, 
 but I'd really like to track down the underlying problem.
 
> On Mar 27, 2019, at 12:17 , Mike Abdullah  wrote:
> 
> Given the number of objects Core Data is designed to juggle, managing 
> that number of weak references might well affect performance. Besides, 
> wouldn’t you still the same result, that your object has a nil reference 
> to the context because the context has been deallocated?
> 
> Furthermore, I think you can also observe this affect on deleted objects 
> once the context has been saved, if you’re still holding a reference to 
> any such objects.
> 
> Mike.
> 
> Sent from my iPhone
> 
>> On 26 Mar 2019, at 21:57, Rick Mann  wrote:
>> 
>> The implication there is that an object has a weak reference to the MOC? 
>> Ah, in the header I see it's `assign`. I wonder why they do that and not 
>> `weak`.
>> 
>> Thanks, I'll look into it.
>> 
>>> On Mar 26, 2019, at 14:50 , Richard Charles  
>>> wrote:
>>> 
>>> You have retained the managed object outside the managed object context.
>>> 
>>> --Richard Charles
>>> 
>>> 
 On Mar 26, 2019, at 1:04 PM, Rick Mann  wrote:
 
 I'm seeing a situation where my NSManagedObject's managedObjectContext 
 is nil. It doesn't happen all the time though. Any idea why? Thanks!
> 


-- 
Rick Mann
rm...@latencyzero.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: NSManagedObject.managedObjectContext is nil???

2019-03-28 Thread Steve Christensen
Is it possible that the entity is retained but has been deleted from the MOC? I 
vaguely recall seeing this myself at one point in the dim past.

> On Mar 27, 2019, at 1:18 PM, Rick Mann  wrote:
> 
> I can't tell. I don't believe I have any unreferenced MOCs.
> 
>> On Mar 27, 2019, at 13:08 , Dave Fernandes  
>> wrote:
>> 
>> Just to clarify, the moc exists, but the reference to it is nil? Or has the 
>> moc, itself, been deallocated?
>> 
>>> On Mar 27, 2019, at 3:40 PM, Rick Mann  wrote:
>>> 
>>> This is proving very hard to diagnose, as it doesn't always happen. I tried 
>>> observing -managedObjectContext, but it never gets called with a nil value. 
>>> Moreover, my entity's -dealloc method is sometimes called even though none 
>>> of the -awake methods gets called. This is a complex app with a lot of 
>>> async operation, so this entity gets created and destroyed often, making it 
>>> that much harder to figure out exactly what's going on.
>>> 
>>> I can bulletproof the place where the crash occurs when the moc is nil, but 
>>> I'd really like to track down the underlying problem.
>>> 
 On Mar 27, 2019, at 12:17 , Mike Abdullah  wrote:
 
 Given the number of objects Core Data is designed to juggle, managing that 
 number of weak references might well affect performance. Besides, wouldn’t 
 you still the same result, that your object has a nil reference to the 
 context because the context has been deallocated?
 
 Furthermore, I think you can also observe this affect on deleted objects 
 once the context has been saved, if you’re still holding a reference to 
 any such objects.
 
 Mike.
 
 Sent from my iPhone
 
> On 26 Mar 2019, at 21:57, Rick Mann  wrote:
> 
> The implication there is that an object has a weak reference to the MOC? 
> Ah, in the header I see it's `assign`. I wonder why they do that and not 
> `weak`.
> 
> Thanks, I'll look into it.
> 
>> On Mar 26, 2019, at 14:50 , Richard Charles  
>> wrote:
>> 
>> You have retained the managed object outside the managed object context.
>> 
>> --Richard Charles
>> 
>> 
>>> On Mar 26, 2019, at 1:04 PM, Rick Mann  wrote:
>>> 
>>> I'm seeing a situation where my NSManagedObject's managedObjectContext 
>>> is nil. It doesn't happen all the time though. Any idea why? Thanks!

___

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