• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Methods with Variable Numbers of Arguments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Methods with Variable Numbers of Arguments
      • From: matt neuburg <email@hidden>
  • Prev by Date: Re: superclass and awakeFromNib
  • Next by Date: Re: Tooltips - what a pathetic joke... :)
  • Previous by thread: Re: Methods with Variable Numbers of Arguments
  • Next by thread: Re: Methods with Variable Numbers of Arguments
  • Index(es):
    • Date
    • Thread