Reputation: 4091
I have the following code:
Product product = [[Product alloc] init];
product.title = tag;
[allProducts addObject:product];
NSString *pImage = [[NSString alloc] initWithFormat:p.title];
But it is failing to return anything
Can anyone kindly help me please? THanks
Upvotes: 0
Views: 77
Reputation: 44073
Nothing in your code is trying to retrieve anything from a collection.
[allProducts addObject:product];
The line above is used for adding objects. If you are looking to retrieve an object you do:
Product* product = [allProducts objectAtIndex:0];
Look at the documentation for NSArray and NSMutableArray.
--update--
Just noticed you have an error in your code:
Product* product = [[Product alloc] init];
(you left out the *)
Upvotes: 1