Re: Opening a file but not associating with NSDocument

2016-05-19 Thread Rick Mann
> On May 19, 2016, at 22:16 , Jerry Krinock wrote: > > >> On 2016 May 19, at 16:13, Rick Mann wrote: >> >> I have a complex NSDocument with lots of files. One of those files is has a >> .mfst extension. If the user double-clicks one of those files, I want my app >> to create my NSDocument s

Re: Opening a file but not associating with NSDocument

2016-05-19 Thread Jerry Krinock
> On 2016 May 19, at 16:13, Rick Mann wrote: > > I have a complex NSDocument with lots of files. One of those files is has a > .mfst extension. If the user double-clicks one of those files, I want my app > to create my NSDocument subclass, and then call a method on it to read the > contents o

Re: Cocoa-dev Digest, Vol 13, Issue 224

2016-05-19 Thread Aaron Tuller
You want: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/#//apple_ref/occ/instm/NSWorkspace/openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers: to open a certain URL with a certain app. and you

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Roland King
> On 20 May 2016, at 07:04, Roland King wrote: > > > Reading the original post he already has the warning about an object being > deallocated whilst still having observers attached to it. > > This is simply a case of putting a breakpoint on dealloc and working out why > the object is being

Re: Cocoa-dev Digest, Vol 13, Issue 224

2016-05-19 Thread Paul Brown
Pardon the ignorance here if there is some (I'm fairly new to OS X development)... If I registered my app with a special url scheme and then sent the mailto url to my app, doesn't that just add an unnecessary hop to the mix? I will already be inside my app clicking the mailto link, so I just need m

Opening a file but not associating with NSDocument

2016-05-19 Thread Rick Mann
I have a complex NSDocument with lots of files. One of those files is has a .mfst extension. If the user double-clicks one of those files, I want my app to create my NSDocument subclass, and then call a method on it to read the contents of that file, but I don't want that to be the file it then

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Roland King
> On 20 May 2016, at 04:36, Jens Alfke wrote: > > >> On May 19, 2016, at 1:24 PM, Alex Zavatone wrote: >> >> In this case, I'm trying to see what is causing this deallocation. In my >> code, I explicitly remove the observer before I nil the object, so I don't >> know where this is happenin

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jens Alfke
> On May 19, 2016, at 1:24 PM, Alex Zavatone wrote: > > In this case, I'm trying to see what is causing this deallocation. In my > code, I explicitly remove the observer before I nil the object, so I don't > know where this is happening. If you’re observing an object, you should probably e

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Alex Zavatone
On May 19, 2016, at 2:10 PM, Jens Alfke wrote: > >> On May 19, 2016, at 9:54 AM, Alex Zavatone wrote: >> >> OK, fair enough. Looks like I'll have build a little weak referenced dealy >> that subclasses dealloc and stops if it detects any observers. > > Holy crap, don’t do that. First, you

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Alex Zavatone
Yeah, I have strong references too, but some part of my NSURLSession code ends up causing this error when we have a failure (SSL challenge) on a file download. I'll have to implement the methods to handle the download failure cases, which I am currently not doing. On May 19, 2016, at 12:57 PM,

Re: Set font on NSTextView that uses bindings?

2016-05-19 Thread Rick Mann
Thanks. Yeah, I think I did suggest 1, once upon a time. Ugh. Guess it'll have to do. I kludged it by making my bound property an NSAttributedString and I set the font on that when setting the value. Really gross, but got me past this hurdle. > On May 19, 2016, at 07:00 , Andy Lee wrote: > >

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jens Alfke
> On May 19, 2016, at 9:54 AM, Alex Zavatone wrote: > > OK, fair enough. Looks like I'll have build a little weak referenced dealy > that subclasses dealloc and stops if it detects any observers. Holy crap, don’t do that. First, you can’t stop a dealloc. Instead you’d have to override retai

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jonathan Mitchell
> On 19 May 2016, at 17:55, Jonathan Mitchell wrote: > > That way the observed object can get deallocated before the observer. Should say That way the observed object cannot get deallocated before the observer. J ___ Cocoa-dev mailing list (Cocoa-d

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jonathan Mitchell
> > Is there any safer KVO technique to prevent or detect the dreaded "An > instance of xx was deallocated while key value observers were still > registered with it"? > I have a ton of observers in NSViewController subclasses. Generally when I use an observer I make 100% sure I have a stro

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Alex Zavatone
On May 19, 2016, at 12:41 PM, Jens Alfke wrote: > >> On May 19, 2016, at 7:51 AM, Alex Zavatone wrote: >> >> Is there a means to have an object know when it's being observed so that it >> will refuse to nuke itself in this condition? > > Nope. Remember, objects don’t “nuke” themselves; they

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jens Alfke
> On May 19, 2016, at 7:51 AM, Alex Zavatone wrote: > > Is there a means to have an object know when it's being observed so that it > will refuse to nuke itself in this condition? Nope. Remember, objects don’t “nuke” themselves; they are dealloced when no other objects have references to them

iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Alex Zavatone
I'm having fun with async NSURLSession downloads but running into objects deleting themselves in error cases while still being observed, resulting in the lovely NSInternalInconsistancyException. Is there a means to have an object know when it's being observed so that it will refuse to nuke itse

Re: Set font on NSTextView that uses bindings?

2016-05-19 Thread Andy Lee
Suggestion 1: A few weeks ago I ran into the same problem. I stumbled onto a kludge that seems to work, which was to put some text into the text view in IB. It can be spaces, it can be anything, as long as it's non-empty and it uses the desired font. It seems that the bindings mechanism is th

Re: Set font on NSTextView that uses bindings?

2016-05-19 Thread Jonathan Mitchell
> On 19 May 2016, at 04:47, Rick Mann wrote: > > I seem to be unable to set the font used in an NSTextView that uses bindings > to set the text content. The property it's bound to creates a plain NSString > (no attributes). > > I've tried setting the font, setting the typing attributes, setti