Re: NSBeginAlertSheet not waiting for button to be pushed
Chad Leigh -- ObjectWerks Inc <chad+macosx-AU1NHruoRJaEK/[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Feb 7, 2010, at 8:32 AM, Uli Kusterer wrote: > On 07.02.2010, at 07:41, Chad Leigh -- ObjectWerks Inc wrote: >> [NSString stringWithFormat:@"message with code %@", [reply objectForKey:@"errorCode"]]); > > It's probably not your issue, but dangerous nonetheless: NSBeginAlertSheet()'s last parameter is already a format string, followed by the arguments. If errorCode contains a percent sign in some way, you'll get a crash or other odd behaviour when the sheet interprets it as a format and tries to interpret whatever is on the stack after the parameters as arguments. > > At the least, the stringWithFormat: in there is unneccessary. Thanks, it did not dawn on me that since I wanted to pass a string, I could just pass it and use as the parameters my own parameter... In this case should be benign as the errorCode is always a 4 digit hex number. I am re-architecting the place in the app where this stuff happens (registration etc) so maybe whatever the problem is will go away. It got too convoluted as I added new layers to the app startup. Chad