Re: Methods with Variable Numbers of Arguments
Re: Methods with Variable Numbers of Arguments
- Subject: Re: Methods with Variable Numbers of Arguments
- From: Joe Osborn <email@hidden>
- Date: Tue, 17 Dec 2002 15:30:18 -0600
I'm just not sure where it could happen... I'm invoking the method like
this:
OSBlock * block = [OSBlock blockWithString:@"[self workEffectively];
return [NSData class];" nouns:self, [NSData class]];
So I don't see how anything could happen to the string constant I feed.
It isn't always EXC_BAD_ACCESS, though. The string sometimes
vanishes(is "invalid" but doesn't crash the app), or loses most of its
contents(once, it was changed to simply "class];"). I'm a bit
perplexed. I think the problem is the way I'm declaring the method...
I'd like it to take a variable number of arguments, so I declared it
thusly:
+(OSBlock *)blockWithString:(NSString *)blockString
nouns:(id)firstNoun, ...;
Is this correct? The compiler doesn't complain, but it seems like the
argument passed is vanishing, and a weird conversion might explain
that? I can't think of any other way a constant NSString would just...
go away. I broke upon entering that method, and blockString was always
"invalid" or otherwise weird.
Thanks for the reply.
--j.osborn
On Tuesday, Dec 17, 2002, at 11:38 US/Central, matt neuburg wrote:
On Sat, 14 Dec 2002 16:56:56 -0600, Joe Osborn <email@hidden> said:
I'm getting a weird bug by which NSConstantStrings suddenly
explode(EXC_BAD_ACCESS) when passed to a method I'm writing that takes
a variable number of arguments. I highly doubt that NSConstantString
has broken over the last three hours, and thus the blame probably
falls
on how I've written my variable-number-of-argument-taking method.
I've no idea what you're trying to do, but my first guess would be
that blame probably falls on a bad access - somewhere you've got a
string that didn't get retained. m.
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.