Re: CoreData Relationships and Array Controllers

2011-10-04 Thread Amy Gibbs

On 2 Oct 2011, at 8:02PM, Quincey Morris wrote:

However, the task of finding all the products for a customer seems  
to be perfectly suited to a Core Data fetch. You should be able to  
set a suitable fetch predicate on the array controller. You'd still  
have to deal with the issue of how you know to update the display  
when the customer-product information changes, but that's always an  
issue for data that's structured by to-many relationships, and you'd  
likely have to solve the problem anyway.


Thank You. It didn't seem like the right way to do it. I'm not much of  
a programmer I'm afraid, and this is an app just for me.


I've googled a Core Data Fetch, and I have got the Hillegass book (2nd  
and 3rd editions) but I can't quite work out what I need to do?


Do I need to use the intermediate ArrayController? Looking at it from  
the other direction it seems quite different. Product - 
>>customerOrderITems->CustomerOrders->Customer doesn't end in a to- 
many relationship, so I'm actually trying to limit the products to  
ones with the selected customer at the end of the keypath. Or, I'm  
looking at limiting the CustomerOrderITems to ones with the selected  
customer at the end of the chain, then actually displaying the related  
productTitle (product attribute) for those items.


This filter/fetch only needs to change when the selected customer  
changes, so it would be good to have this as a separate arrayController?


If anyone could point me in the direction of a good fetching  
explanation or tutorial that would be great.


Thanks

Amy
___

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 arch...@mail-archive.com


printing and the responder chain

2011-10-04 Thread Torsten Curdt
I have a non-document based app. It's a master detail layout with a
NSOutlineView and a custom NSView (in a NSScrollView in a NSSplitView)
on the right. Now when I initiate a "Print" from the menu all that
shows up in the print preview is the outline view.

Reading the documentation from
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Printing/Concepts/architecture.html#//apple_ref/doc/uid/20001053-BAJCHHJG

"Printing is generally initiated by the user choosing the Print menu
command, which usually sends either a print: or printDocument:
message, depending on whether the application is NSDocument-based or
not, up the responder chain. You receive the message either in a
custom NSView object (if it has the keyboard focus), a window
delegate, or an NSDocument object. Upon receipt, you create an
NSPrintOperation object to manage the print job, tell it which NSView
to print, add an accessory view to its print panel, if desired, and
then run the operation. The NSView class defines several methods that
you can override to control how the view is divided between multiple
pages. From there, the view’s drawRect: method draws the view’s
contents"

So I thought I could just implement "print:" in my custom view and
make that view the first responder.

  @implementation CustomView
  - (void) print:(id)sender
  {
  NSLog(@"PRINT");
  }
  @end

  ...

  - (void)awakeFromNib
  {
  [[self window] makeFirstResponder:self.customView];

Now I expected "Print" would only execute the NSLog. But still the
print dialog comes up and has the NSOutlineView only in the preview.

What am I missing here?

cheers,
Torsten
___

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 arch...@mail-archive.com


Re: printing and the responder chain

2011-10-04 Thread Graham Cox

On 04/10/2011, at 9:23 PM, Torsten Curdt wrote:

> "Printing is generally initiated by the user choosing the Print menu
> command, which usually sends either a print: or printDocument:
> message,


So which is it? You can look at the Print menu item in the MainMenu.xib and see 
what its action and target are set to. Target is likely to be nil (first 
responder) but you can set it directly to be the view if it's defined in 
MainMenu.xib. That will help avoid the message going to the wrong object in the 
simple case where there are not multiple windows that can become the target for 
Print at different times.

> Now I expected "Print" would only execute the NSLog. But still the
> print dialog comes up and has the NSOutlineView only in the preview.

In order for your custom view to become first responder, it must also return 
YES from -acceptsFirstResponder but mouse events in the outline view can change 
that to be first responder, so to avoid unexpected surprises with Print, I 
suggest you set the view to be the menu item's direct target. NSView has a 
default implementation of print (inherited by NSOutlineView).

Also, to set the custom view to be the initial first responder, you can connect 
the window's initialFirstResponder outlet to it, to save having to do that in 
-awakeFromNib, but that still requires that the view acceptsFirstResponder to 
function.

--Graham


___

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 arch...@mail-archive.com


Re: printing and the responder chain

2011-10-04 Thread Torsten Curdt
I now have changed the actions in the menu to go through my controller
which (at least in this case) is just fine. Now I can start and
configure the NSPrintOperation myself.

But I am still wondering what was wrong with going through the first responder.

cheers,
Torsten

On Tue, Oct 4, 2011 at 12:23 PM, Torsten Curdt  wrote:
> I have a non-document based app. It's a master detail layout with a
> NSOutlineView and a custom NSView (in a NSScrollView in a NSSplitView)
> on the right. Now when I initiate a "Print" from the menu all that
> shows up in the print preview is the outline view.
>
> Reading the documentation from
> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Printing/Concepts/architecture.html#//apple_ref/doc/uid/20001053-BAJCHHJG
>
> "Printing is generally initiated by the user choosing the Print menu
> command, which usually sends either a print: or printDocument:
> message, depending on whether the application is NSDocument-based or
> not, up the responder chain. You receive the message either in a
> custom NSView object (if it has the keyboard focus), a window
> delegate, or an NSDocument object. Upon receipt, you create an
> NSPrintOperation object to manage the print job, tell it which NSView
> to print, add an accessory view to its print panel, if desired, and
> then run the operation. The NSView class defines several methods that
> you can override to control how the view is divided between multiple
> pages. From there, the view’s drawRect: method draws the view’s
> contents"
>
> So I thought I could just implement "print:" in my custom view and
> make that view the first responder.
>
>  @implementation CustomView
>  - (void) print:(id)sender
>  {
>      NSLog(@"PRINT");
>  }
>  @end
>
>  ...
>
>  - (void)awakeFromNib
>  {
>      [[self window] makeFirstResponder:self.customView];
>
> Now I expected "Print" would only execute the NSLog. But still the
> print dialog comes up and has the NSOutlineView only in the preview.
>
> What am I missing here?
>
> cheers,
> Torsten
>
___

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 arch...@mail-archive.com


PDF viewing

2011-10-04 Thread Dan Hopwood
Hi all,

Is there any way to open a PDF without using a UIWebView i.e. like the Mail
app?

Many thanks,

Dan
___

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 arch...@mail-archive.com


Re: printing and the responder chain

2011-10-04 Thread Torsten Curdt
> In order for your custom view to become first responder, it must also return
> YES from -acceptsFirstResponder

head ... desk

Off course! I bet that was it ...but as you said: to avoid surprises I
better move the action off the first responder.

Thanks, Graham!

cheers,
Torten

> but mouse events in the outline view can
> change that to be first responder, so to avoid unexpected surprises with
> Print, I suggest you set the view to be the menu item's direct target.
> NSView has a default implementation of print (inherited by NSOutlineView).
> Also, to set the custom view to be the initial first responder, you can
> connect the window's initialFirstResponder outlet to it, to save having to
> do that in -awakeFromNib, but that still requires that the view
> acceptsFirstResponder to function.
> --Graham
>
>
___

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 arch...@mail-archive.com


Re: PDF viewing

2011-10-04 Thread Eric Gorr
Yes. See the ZoomingPDFViewer sample code.

 
http://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introduction/Intro.html

>From the description:

 This sample code project demonstrates how to create a PDF viewer using the 
UIScrollView and CATilerLayer classes.


On Oct 4, 2011, at 7:26 AM, Dan Hopwood wrote:

> Is there any way to open a PDF without using a UIWebView i.e. like the Mail
> app?

___

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 arch...@mail-archive.com


Re: PDF viewing

2011-10-04 Thread Graham Cox

On 04/10/2011, at 10:26 PM, Dan Hopwood wrote:

> Is there any way to open a PDF without using a UIWebView i.e. like the Mail
> app?


Errr... NSImage?

--Graham


___

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 arch...@mail-archive.com


Re: PDF viewing

2011-10-04 Thread Graham Cox

On 04/10/2011, at 10:34 PM, Graham Cox wrote:

> 
> On 04/10/2011, at 10:26 PM, Dan Hopwood wrote:
> 
>> Is there any way to open a PDF without using a UIWebView i.e. like the Mail
>> app?
> 
> 
> Errr... NSImage?


Never mind - I see you're probably asking about iOS, not Mac (a better title 
would have helped make that clear). UIImage doesn't support pdf.

--Graham


___

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 arch...@mail-archive.com


Fine-tuning NSTextField auto completion

2011-10-04 Thread Nala Gnirut
Hi all,
in my project I'm using NSControlTextEditingDelegate to auto complete what's
typed in a NSTextField with search location suggestions retrieved from
Google Maps API. "complete:" message is automatically sent to field editor
by a NSTimer short after user ends typing.

Now I'd like to fine-tune the behavior of auto-completion and have it
working exactly as Google search text field works in Safari:

1) When two or more words (separated by spaces) are typed in NSTextField,
location for NSRange passed in

- (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView
completions:(NSArray *)words forPartialWordRange:(NSRange)charRange
indexOfSelectedItem:(NSInteger *)index

starts after the last space typed.

This means that if user types "San Fran" and Google APIs returns "San
Francisco", choosing it from auto-complete list NSTextField value is
replaced with "San San Francisco".

My current workaround consist in rebuilding NSArray containing completion
and returning only part of the actual completions returned by Google API,
depending on charRange.location. This looks crappy (because auto-completion
list now shows only part of the completion string), so I want to have
NSTextField ignore spaces when requesting auto-completion.

2) Choosing an auto completion from list, default NSTextField action is not
sent. At the moment user need to choose an auto completion and then press
enter to trigger search. This happens because in IB I chose to send action
on enter only. This is the expected behavior for user not choosing a
completion, but I want action sent on auto-completion.

Thanks in advance.
___

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 arch...@mail-archive.com


Quicklook not working for network volume items

2011-10-04 Thread Chris Paveglio
I am trying to get Quicklook working in an app of mine. I'm not sure all these 
details are relevant, but better to have more than less info. I have a table 
that shows the number of files in certain folders on a network volume. In one 
column is the number of files, another column shows the first couple files 
names, as a string that was concatenated. My data object for each row has an 
array that stores NSURL's of all of the files. I want the quicklook to show 
previews for all the files in the folder.

So far I am successful in storing the NSURL's and to retrieve them. When I 
bring up the quicklook panel, I can see the number of items, it displays a 
generic icon of the first file, and I can cycle through to other files, and it 
displays the name of each file correctly. BUT, the preview panel will not show 
me a real icon or preview of any file, only the generic blank white page icon. 
If I override the panel methods:
- (id )previewPanel:(QLPreviewPanel *)panel 
previewItemAtIndex:(NSInteger)index
and
- (NSURL *)previewItemURL

to return an NSURL to a file on my hard drive, then the quicklook preview works 
properly and I see the actual image of the PDF. If I override those methods to 
use a hard coded NSURL to the same file on a network volume, the generic blank 
white-document icon shows up.
So, what am I missing? I don't understand why this works locally but not on a 
network volume. The Finder shows the network item's quicklook preview properly.

Here's my methods:
- (NSURL *)previewItemURL
{
//return [NSURL 
URLWithString:@"file://localhost/Users/chris.paveglio/Desktop/Using%20Native%20Ai%20Files.pdf"];

return[NSURLURLWithString:@"file://Volumes/Clippers2011/DTDWriteup/Team%203/%20%20Prep/Using%20Native%20Ai%20Files.pdf"];
}

- (id )previewPanel:(QLPreviewPanel *)panel 
previewItemAtIndex:(NSInteger)index
{
//actual methods to use
//NSInteger selectedRow = [myTableView selectedRow];
//PrepworkItem*p = [[pwArrayControllerarrangedObjects] 
objectAtIndex:selectedRow];
//return [[p urlToCurrentItems] objectAtIndex:index];

//testing return values
//return [NSURL 
URLWithString:@"file://localhost/Users/chris.paveglio/Desktop/Using%20Native%20Ai%20Files.pdf"];
return[NSURLURLWithString:@"file://Volumes/Clippers2011/DTDWriteup/Team%203/%20%20Prep/Using%20Native%20Ai%20Files.pdf"];
}

Thanks,
Chris
___

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 arch...@mail-archive.com


App opens in background after adding Growl support.

2011-10-04 Thread Todd Freese
I just added the Growl framework to my app and it works great. Except… now my 
app always launches in the background. Everything else works great. If I 
disable growl, my app opens in the foreground as expected. Does this on Snow 
Leopard or Lion.

Has anyone seen this?

Todd Freese
The Filmworkers Club

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___

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 arch...@mail-archive.com


Re: App opens in background after adding Growl support.

2011-10-04 Thread Laurent Daudelin
On Oct 4, 2011, at 10:01, Todd Freese wrote:

> I just added the Growl framework to my app and it works great. Except… now my 
> app always launches in the background. Everything else works great. If I 
> disable growl, my app opens in the foreground as expected. Does this on Snow 
> Leopard or Lion.
> 
> Has anyone seen this?

I've been using Growl in 2 of my apps for a couple of years now and never 
noticed this.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laurent@nemesys-soft.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: App opens in background after adding Growl support.

2011-10-04 Thread Todd Freese
Are you just issuing a :
[GrowlApplicationBridge setGrowlDelegate:self];

at startup?

Todd


On Oct 4, 2011, at 3:31 PM, Laurent Daudelin wrote:

> On Oct 4, 2011, at 10:01, Todd Freese wrote:
> 
>> I just added the Growl framework to my app and it works great. Except… now 
>> my app always launches in the background. Everything else works great. If I 
>> disable growl, my app opens in the foreground as expected. Does this on Snow 
>> Leopard or Lion.
>> 
>> Has anyone seen this?
> 
> I've been using Growl in 2 of my apps for a couple of years now and never 
> noticed this.
> 
> -Laurent.
> -- 
> Laurent Daudelin
> AIM/iChat/Skype:LaurentDaudelin   
> http://www.nemesys-soft.com/
> Logiciels Nemesys Software
> laur...@nemesys-soft.com
> 
> __
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> __
> 



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___

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 arch...@mail-archive.com


Re: Years-old mysterious bindings crash

2011-10-04 Thread Seth Willits

On Oct 3, 2011, at 8:56 PM, Quincey Morris wrote:

> On Oct 3, 2011, at 18:29 , Seth Willits wrote:
> 
>> I've been receiving reports of this rare but persistent crash over the past 
>> few years, and I've never been able to reproduce it or figure out what's 
>> causing it.
> 
> One thing you could do, if you have an actual crash dump to examine, is to 
> work out which register contains the 1st parameter to 
> [NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] and 
> examine the string at that location. Knowing the keypath *may* give a clue as 
> to what's going on.

All I have is the crash logs, so I can only see the register content for the 
top of the stack. I wish I could figure out how to reproduce it. In a couple 
cases they say they simply launched the app and it crashed (and that would be 
the first stack trace), but then it works fine. It's rare. I wrote a script to 
launch the thing thousands of times and I can never get it to crash. It's mega 
frustrating. 



> You could also try setting a breakpoint on setContent in one of your two 
> scenarios, and examine the object controller's observationInfo to see what 
> observers the object controller has at this point. Presumably, the (an?) 
> observer in a non-crashy situation is the object whose memory management you 
> need to suspect.

Well in the first case it's nil because there are no observers. That's why I'm 
sure it has nothing to do with the specific controller or binding. It's truly 
bizarre. 



--
Seth Willits



___

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 arch...@mail-archive.com


Strange mystery with Core Animation

2011-10-04 Thread Graham Cox
Here's a weird one.

I have some Core Animation layers (specifically, it's a CAReplicatorLayer), and 
I'm changing the 'instanceTransform' property in order to shift the position of 
the reflection up and down.

When I trigger this code from a mouse click (through a checkbox, in a different 
window), all is well - the reflection position changes and animates, but when I 
trigger it through a key press (keyDown event), nothing happens. I have 
verified that the method does actually run in both cases, and has the exact 
same parameters. Other changes made to other layers at the same time do work 
correctly, it's just these reflection transforms that are being ignored.

Can anyone offer any explanation for this? 

--Graham


___

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 arch...@mail-archive.com


Re: Years-old mysterious bindings crash

2011-10-04 Thread William Squires
Sounds like you're inadvertently depending on the order of loading somehow. Are 
you setting up all your bindings in awakeFromNib:? Or do you have any bindings 
(set in IB) which refer to something the controller object may have to load 
first? Just a thought.

On Oct 3, 2011, at 8:29 PM, Seth Willits wrote:

> 
> I've been receiving reports of this rare but persistent crash over the past 
> few years, and I've never been able to reproduce it or figure out what's 
> causing it.
> 
> They often look exactly like the stack trace below, but sometimes it's 
> different, happening at a different time. The thing they all have in common 
> is it's a crash when notifying observers in a binding when loading a nib.
> 
> 
> 
> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_INVALID_ADDRESS at 0x0828
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Application Specific Information:
> objc_msgSend() selector name: respondsToSelector:
> 
> 
>   objc_msgSend_vtable5 + 16
>   NSKeyValueNotifyObserver + 76
>   -[NSObject(NSKeyValueObservingPrivate) 
> _notifyObserversForKeyPath:change:] + 991
>   -[NSController _notifyObserversForKeyPath:change:] + 218
>   -[NSObjectController setContent:] + 369
>   -[AQConnTabController awakeFromNib] + 976
>   -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1515
>   -[NSNib instantiateNibWithExternalNameTable:] + 564
>   -[NSNib instantiateNibWithOwner:topLevelObjects:] + 233
>   -[NSViewController loadView] + 180
>   -[NSViewController view] + 38
>   -[AQConnTabController initWithNibName:bundle:windowController:] + 801
>   -[AQConnWindowController newTab:] + 56
>   -[NSWindowController _windowDidLoad] + 538
>   -[NSWindowController window] + 112
>   -[NSWindowController showWindow:] + 47
>   -[AQController newConnectionWindow:] + 72
>   -[AQController applicationOpenUntitledFile:] + 18
>   -[NSApplication _doOpenUntitled] + 211
>   -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] 
> + 101
>   -[NSAppleEventManager 
> dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 360
>   _NSAppleEventManagerGenericHandler + 114
>   aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned 
> char*) + 162
>   dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 32
>   aeProcessAppleEvent + 210
>   AEProcessAppleEvent + 48
>   _DPSNextEvent + 1191
>   -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
>   -[NSApplication run] + 395
>   NSApplicationMain + 364
>   start + 52
> 
> 
> 
> In this case [AQConnTabController awakeFromNib] calls setContent: on a object 
> controller that AQConnTabController creates. The weird thing about that 
> leading to a crash is that the object controller isn't hooked up to 
> _anything_ yet.  I'm certain it has nothing to do with that specific object 
> controller. Other crashes have a similar trace at the top:
> 
> 
>   objc_msgSend_vtable5 + 24
>   NSKeyValueNotifyObserver + 61
>   -[NSObject(NSKeyValueObservingPrivate) 
> _notifyObserversForKeyPath:change:] + 756
>   -[NSController _notifyObserversForKeyPath:change:] + 206
>   -[NSObjectController setContent:] + 395
>   -[NSObjectDetailBinder refreshDetailContent] + 230
>   -[NSObject(NSKeyValueBindingCreation) 
> bind:toObject:withKeyPath:options:] + 591
>   -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1079
>   -[NSNib instantiateNibWithExternalNameTable:] + 606
>   -[NSNib instantiateNibWithOwner:topLevelObjects:] + 251
>   -[NSViewController loadView] + 186
> 
> 
> The thing they all have in common is that a nib is being loaded, which does 
> some stuff with bindings, and then there's a crash. The bindings aren't even 
> related in terms of what's connected to what. 
> 
> 
> What I believe is going on, is that somehow a deallocated object is still an 
> observer somewhere, and at any point when the KVO system needs to notify 
> somebody of any KVO message, it crashes when it tries to send a message to 
> that deallocated object. The trouble is, I have _no_ clue how to find this. 
> I've tried for endless hours over the years scouring my code for any whiff of 
> something being done wrong and I've never found it. I swear the code 
> everywhere I've looked is fine, the analyzer doesn't point out any mistakes, 
> Valgrind is fine, I'm confident I don't have any memory smashers etc What 
> can I do to figure this out? Anybody have any tricky ideas?
> 
> I'm hoping somebody has seen this stack trace before and knows what kind of 
> subtle bug causes it. :\
> 
> 
> 
> Thanks,
> 
> 
> --
> Seth Willits
> 
> 
> 
> ___
> 
> 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-a

Re: Years-old mysterious bindings crash

2011-10-04 Thread Seth Willits
On Oct 4, 2011, at 5:18 PM, William Squires wrote:

> Sounds like you're inadvertently depending on the order of loading somehow. 
> Are you setting up all your bindings in awakeFromNib:? Or do you have any 
> bindings (set in IB) which refer to something the controller object may have 
> to load first? Just a thought.

There aren't any bindings setup at the point it crashes. The controller is 
connected to absolutely nothing. It literally is

controller = [[NSObjectController alloc] initWithContent:nil];
 ... unrelated things ...

[self view];

In awakeFromNib:
[controller setContent:obj]; 
kaboom.


The evidence I have supports that KVO has a rogue registration in it. I have 
new evidence for that, which I'm still working through. I'll post about that 
later when I know more.

I magically did manage to make the thing crash today while opening a ton of 
windows and tabs while connected to Instruments trying to find a leak. I tried 
to replicate it... can't. It's so rare. I've opened hundreds and hundreds of 
windows and tabs and closed them in all kinds of random orders...


--
Seth Willits



___

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 arch...@mail-archive.com


[SOLVED] Re: Strange mystery with Core Animation

2011-10-04 Thread Graham Cox
Never mind - silly mistake elsewhere, as expected…..

G.


On 05/10/2011, at 10:56 AM, Graham Cox wrote:

> Can anyone offer any explanation for this? 

___

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 arch...@mail-archive.com


Re: Years-old mysterious bindings crash

2011-10-04 Thread Quincey Morris
On Oct 4, 2011, at 17:59 , Seth Willits wrote:

> There aren't any bindings setup at the point it crashes. The controller is 
> connected to absolutely nothing. It literally is
> 
> controller = [[NSObjectController alloc] initWithContent:nil];
> ... unrelated things ...
> 
> [self view];
> 
> In awakeFromNib:
> [controller setContent:obj]; 
> kaboom.
> 
> 
> The evidence I have supports that KVO has a rogue registration in it. I have 
> new evidence for that, which I'm still working through. I'll post about that 
> later when I know more.
> 
> I magically did manage to make the thing crash today while opening a ton of 
> windows and tabs while connected to Instruments trying to find a leak. I 
> tried to replicate it... can't. It's so rare. I've opened hundreds and 
> hundreds of windows and tabs and closed them in all kinds of random orders...

Aren't there things in the nib file itself that are bound to or through the 
object controller? I assumed so, since otherwise there's likely no point to 
have the controller at all. That would mean there are bindings existing before 
the setContent:, which of course dead-end at a nil object in the key path until 
you get everything connected. Maybe one of those is dysfunctional in an 
unexpected way.

It's also possible that the setContent: triggers a series of steps internal to 
the object controller, including the creation of private auxiliary objects and 
multiple observations. The stack trace makes things look like a single property 
change notification is trying to occur, but it ain't necessarily that simple.

The only other straw I can think of to grasp at is the timing of the 
setContent: in the above code sequence. We've been encouraged away from doing 
things at awakeFromNib time when there is an xxxDidLoad alternative. Now, 
NSViewController doesn't *have* a viewDidLoad, but the equivalent would be to 
do things after [super loadView] returns, and in your above sequence, that 
would actually be after [self view] returns. Is it a functional possibility to 
do the setContent: at that point instead of in awakeFromNib?

That wouldn't really apply to your other scenario, but it's the best ridiculous 
idea I can come up with.


___

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 arch...@mail-archive.com


Re: CoreData Relationships and Array Controllers

2011-10-04 Thread Quincey Morris
On Oct 4, 2011, at 01:49 , Amy Gibbs wrote:

> If anyone could point me in the direction of a good fetching explanation or 
> tutorial that would be great.

I don't know of a good reference for you. Googling is as likely as not to turn 
something up. I'd also suggest you try reading about fetches in the Core Data 
reference. It may contain more detail than you're ready to absorb, but it may 
help.

I think I would approach the problem like this:

First, see if you can use an array controller to display all the order items 
from every order from every customer. I'm not sure offhand, but I think that 
just involves setting (in the array controller in IB) the correct entity type 
for the order items, supplying a managed object context, and setting "prepares 
content automatically" to YES.

If you can do that, you should be able to add a fetch predicate to that array 
controller, which selects just the customer you want. This is likely to be 
fiddly rather than hard.

Those two things together should give you the list you want, and then you can 
use the related product information as detail, either in the list or in a 
separate detail view.

I know it's no help to say so, but it's true that using Core Data is an 
advanced topic. If you want to use the technology, you may be forced to get a 
bit more technical that you had otherwise intended.


___

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 arch...@mail-archive.com


Re: Strange mystery with Core Animation

2011-10-04 Thread Seth Willits
On Oct 4, 2011, at 4:56 PM, Graham Cox wrote:

> Here's a weird one.
> 
> I have some Core Animation layers (specifically, it's a CAReplicatorLayer), 
> and I'm changing the 'instanceTransform' property in order to shift the 
> position of the reflection up and down.
> 
> When I trigger this code from a mouse click (through a checkbox, in a 
> different window), all is well - the reflection position changes and 
> animates, but when I trigger it through a key press (keyDown event), nothing 
> happens. I have verified that the method does actually run in both cases, and 
> has the exact same parameters. Other changes made to other layers at the same 
> time do work correctly, it's just these reflection transforms that are being 
> ignored.
> 
> Can anyone offer any explanation for this? 


Hmm. That would be an interesting one to play with if you can replicate it in a 
new project. The weirdest one I've come across is the CALayer convertPoint 
methods actually break CATransactions (sometimes).



--
Seth Willits



___

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 arch...@mail-archive.com


Use Subclass in Interface Builder

2011-10-04 Thread Dong Feng
I have a subclass of NSOpenGLView which named POpenGLView. I tried two ways
to use it in IB:

Method 1:
To create an OpenGL view in IB directly, and set its class type
"POpenGLView".

Method 2:
To create a NSView in IB, and set its class type "POpenGLView".

The most significant difference between the two ways is
  - in Method 2, initWithFrame: is invoked.
  - in Method 1, initWithCoder: is invoked.

I checked Apple examples and found this one:
http://developer.apple.com/library/mac/#samplecode/GLEssentials/Listings/main_m.html#//apple_ref/doc/uid/DTS40010104-main_m-DontLinkElementID_31

Apple's example takes Method 2 and relies on the behavior of invoking
initWithFrame: .

What's the rule of IB/XIB regarding picking instantiate method?

Thanks,
Dong
___

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 arch...@mail-archive.com


Re: Use Subclass in Interface Builder

2011-10-04 Thread Andy Lee
See "The Object Loading Process":


> a. Standard Interface Builder objects (and custom subclasses of those 
> objects) receive an initWithCoder: message.
[...]
> b. Custom views in Mac OS X receive an initWithFrame: message.

Your Method 1 corresponds to the "a" case. Your Method 2 corresponds to the "b" 
case.

--Andy


On Oct 5, 2011, at 1:32 AM, Dong Feng wrote:

> I have a subclass of NSOpenGLView which named POpenGLView. I tried two ways
> to use it in IB:
> 
> Method 1:
> To create an OpenGL view in IB directly, and set its class type
> "POpenGLView".
> 
> Method 2:
> To create a NSView in IB, and set its class type "POpenGLView".
> 
> The most significant difference between the two ways is
>  - in Method 2, initWithFrame: is invoked.
>  - in Method 1, initWithCoder: is invoked.
> 
> I checked Apple examples and found this one:
> http://developer.apple.com/library/mac/#samplecode/GLEssentials/Listings/main_m.html#//apple_ref/doc/uid/DTS40010104-main_m-DontLinkElementID_31
> 
> Apple's example takes Method 2 and relies on the behavior of invoking
> initWithFrame: .
> 
> What's the rule of IB/XIB regarding picking instantiate method?
> 
> Thanks,
> Dong
___

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 arch...@mail-archive.com


Re: Use Subclass in Interface Builder

2011-10-04 Thread Dong Feng
Thank you, Andy.

But slightly wired that NSOpenGLView isn't considered as a custom view,
considering it itself is a subclass of NSView. Anyway at least I can count
on the way it works. :-)



2011/10/5 Andy Lee 

> See "The Object Loading Process":
>
> <
> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/1051i-CH4-SW19
> >
> > a. Standard Interface Builder objects (and custom subclasses of those
> objects) receive an initWithCoder: message.
> [...]
> > b. Custom views in Mac OS X receive an initWithFrame: message.
>
> Your Method 1 corresponds to the "a" case. Your Method 2 corresponds to the
> "b" case.
>
> --Andy
>
>
> On Oct 5, 2011, at 1:32 AM, Dong Feng wrote:
>
> > I have a subclass of NSOpenGLView which named POpenGLView. I tried two
> ways
> > to use it in IB:
> >
> > Method 1:
> > To create an OpenGL view in IB directly, and set its class type
> > "POpenGLView".
> >
> > Method 2:
> > To create a NSView in IB, and set its class type "POpenGLView".
> >
> > The most significant difference between the two ways is
> >  - in Method 2, initWithFrame: is invoked.
> >  - in Method 1, initWithCoder: is invoked.
> >
> > I checked Apple examples and found this one:
> >
> http://developer.apple.com/library/mac/#samplecode/GLEssentials/Listings/main_m.html#//apple_ref/doc/uid/DTS40010104-main_m-DontLinkElementID_31
> >
> > Apple's example takes Method 2 and relies on the behavior of invoking
> > initWithFrame: .
> >
> > What's the rule of IB/XIB regarding picking instantiate method?
> >
> > Thanks,
> > Dong
>
___

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 arch...@mail-archive.com