Re: verify input parameter of init method and return nil before invoke [super init]

2013-01-29 Thread Quincey Morris
On Jan 29, 2013, at 23:25 , Greg Parker wrote: > Name the method `new...` instead of `create...`. Otherwise you do suffer an > autorelease penalty with ARC. (`create...` is not one of the names that ARC > assumes will return a retained result.) Oops, I'm always getting that backwards. Need to

Re: verify input parameter of init method and return nil before invoke [super init]

2013-01-29 Thread Greg Parker
On Jan 29, 2013, at 10:25 PM, Quincey Morris wrote: > However, it occurs to me there's a better solution. Since we're talking about > ARC, this pattern: > > + (id) createBlaWithFoo: (NSString*) foo // or the return type can be Bla* if > you want > { > if (!foo) > return nil

Re: verify input parameter of init method and return nil before invoke [super init]

2013-01-29 Thread Quincey Morris
On Jan 29, 2013, at 20:51 , Ken Thomases wrote: > Bob's construction is just as valid as the above because it's essentially > doing the same thing. The same thing, so it doesn't really adduce any further evidence (unless you know of a documented API contract that covers this situation). Howev

Re: verify input parameter of init method and return nil before invoke [super init]

2013-01-29 Thread Charles Srstka
On Jan 29, 2013, at 10:51 PM, Ken Thomases wrote: > I disagree. I think Bob's construction is valid, if unconventional. It is > also valid-though-unconventional to release an object that you've +alloc'd > but not -init'd at the caller side. > > SomeClass* foo = [SomeClass alloc]; > if (someC

Re: verify input parameter of init method and return nil before invoke [super init]

2013-01-29 Thread Ken Thomases
On Jan 29, 2013, at 3:22 AM, Quincey Morris wrote: > On Jan 29, 2013, at 00:51 , Bob Cromwell wrote: > >> if below code valid ? All sample codes I could find invoke "self = [super >> init]" first and then check the input parameter inside "if (self)" block. >> >> @implementaion Bla >> >> -

Re: Symbol not found: _OBJC_CLASS_$_NSObject

2013-01-29 Thread Greg Parker
On Jan 29, 2013, at 6:12 PM, Todd Heberlein wrote: > I mentioned this in a previous Xcode, but I thought it might be different > enough topic so I've given it a new subject and brought it over to Cocoa > (might be a more appropriate forum) > > I have embedded private frameworks in a Cocoa Mac

Symbol not found: _OBJC_CLASS_$_NSObject

2013-01-29 Thread Todd Heberlein
I mentioned this in a previous Xcode, but I thought it might be different enough topic so I've given it a new subject and brought it over to Cocoa (might be a more appropriate forum) I have embedded private frameworks in a Cocoa Mac OS X application. The development environment is OS X 10.8.2 a

Weird Scrollbar behavior

2013-01-29 Thread livinginlosangeles
Has anyone every seen this kind of weird scroll bar behavior? I embedded a custom view in an NSScrollView. The scroll bars do not appear to be drawing correctly, and they also appear in the middle of my custom view. This happens on 10.6, yet not when I build on 10.7. I also see it on 10.8. I ha

Re: NSDocument's Open File Panel unresponsive when opening large file from disc

2013-01-29 Thread Quincey Morris
On Jan 29, 2013, at 12:00 , Gilles Celli wrote: > Ok, sounds good...but what bothers me is that I'm using an NSDocument based > app: > so can I use without problems NSOpenPanel's > beginSheetModalForWindow:completionHandler: method instead of using > NSDocument's readFomURL:ofType:error ? If

Re: NSDocument's Open File Panel unresponsive when opening large file from disc

2013-01-29 Thread Gilles Celli
Ok, sounds good...but what bothers me is that I'm using an NSDocument based app: so can I use without problems NSOpenPanel's beginSheetModalForWindow:completionHandler: method instead of using NSDocument's readFomURL:ofType:error ? On 29 janv. 2013, at 18:36, Quincey Morris wrote: > On Jan 2

Re: verify input parameter of init method and return nil before invoke [super init]

2013-01-29 Thread Quincey Morris
On Jan 29, 2013, at 09:07 , Jens Alfke wrote: > Actually this is fine, because free(NULL) is legal. A better example would be > a dealloc that calls CFRelease, because [for some reason] CFRelease does > crash if passed NULL. Yes, no one is ever going to hire me for my deep Unix knowledge. > I

Re: NSNetService

2013-01-29 Thread Jens Alfke
On Jan 28, 2013, at 7:59 PM, eric_h_sm...@mac.com wrote: > I'm using NSNetService to publish a service on a network... and I cannot > remove that service without restarting the computer. The only thing I've > found in any list or discussion board is [myNetService stop], and this does > not wo

Re: NSDocument's Open File Panel unresponsive when opening large file from disc

2013-01-29 Thread Quincey Morris
On Jan 29, 2013, at 08:18 , Gilles Celli wrote: > Simply put, the Open Panel should be closed, but it stays open until the data > file has been processed and the data displayed as a graph. If you're using one of the 'begin…completionHandler:' methods to show the panel, you can invoke '[openPan

Re: NSDocument's Open File Panel unresponsive when opening large file from disc

2013-01-29 Thread Steve Mills
On Jan 29, 2013, at 10:18:57, Gilles Celli wrote: > Simply put, the Open Panel should be closed, but it stays open until the data > file has been processed and the data displayed as a graph. > > There should be a way to close NSDocument openPanel but didn't find anything > about it… I agree.

Re: verify input parameter of init method and return nil before invoke [super init]

2013-01-29 Thread Jens Alfke
On Jan 29, 2013, at 1:22 AM, Quincey Morris wrote: > ** Here's an example that will crash with an early return: > > if (self) { > if (foo == nil) > return nil; > _foo = foo; > _bar = malloc (100); > . > } > ….. > - (void) dealloc { >free (_bar); >

Re: NSDocument's Open File Panel unresponsive when opening large file from disc

2013-01-29 Thread Gilles Celli
I looked a little bit today here with my application, and the term unresponsive for the Open Panel is not appropriate: it should be "stays open" when reading /processing the big data file and then the panel closes. The main processing time is when converting date/time to NSTimeIntervalSince1970

Re: NSNetService

2013-01-29 Thread Roland King
On 29 Jan, 2013, at 11:32 PM, Gerd Knops wrote: > > On Jan 28, 2013, at 9:59 PM, eric_h_sm...@mac.com wrote: > >> All, >> >> I'm using NSNetService to publish a service on a network... and I cannot >> remove that service without restarting the computer. > > In my case I do absolutely nothin

Re: NSNetService

2013-01-29 Thread Gerd Knops
On Jan 28, 2013, at 9:59 PM, eric_h_sm...@mac.com wrote: > All, > > I'm using NSNetService to publish a service on a network... and I cannot > remove that service without restarting the computer. In my case I do absolutely nothing to stop the service, and when the app quits the service reliab

Re: NSNetService

2013-01-29 Thread John Pannell
Hmmm... are you sure you have kept a strong reference/pointer to your net service? I have production code that uses [service stop] and I can see the broadcasting service disappear immediately from other net service browsing peers. If your reference is nil, however, the stop message could fall

Re: verify input parameter of init method and return nil before invoke [super init]

2013-01-29 Thread Quincey Morris
On Jan 29, 2013, at 00:51 , Bob Cromwell wrote: > if below code valid ? All sample codes I could find invoke "self = [super > init]" first and then check the input parameter inside "if (self)" block. > > @implementaion Bla > > - (id)initWithFoo:(NSString *)foo > { >if (foo == nil) { >

verify input parameter of init method and return nil before invoke [super init]

2013-01-29 Thread Bob Cromwell
Hi All, if below code valid ? All sample codes I could find invoke "self = [super init]" first and then check the input parameter inside "if (self)" block. @implementaion Bla - (id)initWithFoo:(NSString *)foo { if (foo == nil) { return nil; } self = [super init]; if