Friday, 15 August 2014

objective c - iOS: value not coming as String? -



objective c - iOS: value not coming as String? -

in code, set array within nsmutabledictionary as

if (array.count > 0) { [self.filters setvalue:array forkey:[self getkey:[[nsnumber numberwithint:indexpath.section] intvalue]]]; }

where array

nsmutablearray *array = [[nsmutablearray alloc] init];

when receiving code receives it, tried bring together values in array

if ([item objectforkey:@"category_filter"] != nil) { nsarray *array = [nsarray arraywithobjects:[item objectforkey:@"category_filter"], nil]; nsstring *categories = [array componentsjoinedbystring:@","]; nslog(@"value:%@", categories); }

where item (nsmutabledictionary *)item

when see log, see

2014-06-24 17:43:12.520 yelp[69744:70b] value:( "bagels (bagels)", "bakeries (bakeries)" )

so not joined yet. doing wrong here?

as hot licks commented,

i had create alter

nsarray *array = [nsarray arraywitharray:[item objectforkey:@"category_filter"]];

instead of

nsarray *array = [nsarray arraywithobjects:[item objectforkey:@"category_filter"]];

ios objective-c

No comments:

Post a Comment