Ashish
Ashish

Reputation: 207

Values of NSArray does not print

NSArray *headerDataArrays =[NSArray arrayWithObjects:((FNPayment *)fnPayment), nil];
NSLog(@"count====%d", headerDataArrays.count); // 1

But I am not unable to print array value. Also total array. I have tried like bellow.
NSLog(@"paymentMethod=== %@", [headerDataArrays objectAtIndex:2]);

Upvotes: 0

Views: 61

Answers (2)

vp_gold
vp_gold

Reputation: 532

Have you defined a description method for your FNPayment class?

- (NSString *)description {
     NSString *descriptionString = [NSString stringWithFormat:@"blah %@; blah blah: %@;", self.b, self.bb];
     return descriptionString;

}

Objective C does not know what to print for your class, but it should print the address at the least.

Upvotes: 0

ppalancica
ppalancica

Reputation: 4277

The array size in this case is 1 only, so index 2 (and even index 1) would be out of the bounds, because indexes are in the interval [0..[array count] - 1] in Objective-C.

Upvotes: 1

Related Questions