• 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: putting structs in NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: putting structs in NSArray


  • Subject: Re: putting structs in NSArray
  • From: Ben Dougall <email@hidden>
  • Date: Tue, 26 Aug 2003 14:46:15 +0100

i just can't suss this one. trying to put a struct into an array:

struct str {
int x;
char y;
BOOL z;
};
struct str s = {123456, '*', YES};

NSMutableArray *a = [[NSMutableArray alloc] initWithCapacity:2];

NSValue *v = [NSValue value:&s objCType:@encode(struct str)];

[a addObject: v];

for the NSValue line i get:
main.m:34: warning: cannot find class (factory) method
main.m:34: warning: return type for `value:objCType:' defaults to id

seems as if @encode isn't getting the information it needs - it's not linking up with the str struct declaration or something? what am i doing wrong?

if anyone's got any ideas it'd be much appreciated. thanks, ben.
_______________________________________________
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: putting structs in NSArray
      • From: Dylan Adams <email@hidden>
    • Re: putting structs in NSArray
      • From: Glen Simmons <email@hidden>
References: 
 >Re: putting structs in NSArray (From: "Alastair J.Houghton" <email@hidden>)

  • Prev by Date: Re: How to display an EPS file?
  • Next by Date: Re: My runs through Xcode but not in the Finder...
  • Previous by thread: Re: putting structs in NSArray
  • Next by thread: Re: putting structs in NSArray
  • Index(es):
    • Date
    • Thread