Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableViewController unrecognized selector sent to instance 0xa17c1f0
    primarykey
    data
    text
    <p>I am new in iOS Development and currently I am working on a Tabbed Application which contains 4 tabs. On one of my tabs I am trying to display a table view but i get the following error.</p> <p><strong>2013-03-13 14:15:35.416 STAM[4054:c07] -[UITableViewController setProducts:]: unrecognized selector sent to instance 0xa17c1f0</strong></p> <p>I created a ProductsViewController class which is a subclass of UITableViewController, and also i hooked up the TableViewController to the ProductViewController in the StoryBoard.</p> <p>I also created a Product class where I inserted the following properties:</p> <p>Product.h</p> <pre><code> #import &lt;Foundation/Foundation.h&gt; @interface Product : NSObject @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSString *number; @end </code></pre> <p>In AppDelegate.m i did the following:</p> <pre><code>@implementation AppDelegate { NSMutableArray *products; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { products = [NSMutableArray arrayWithCapacity:20]; Product *product = [[Product alloc] init]; product.name = @"Test Product"; product.number = @"123546"; [products addObject:product]; product = [[Product alloc] init]; product.name = @"Test Product 2"; product.number = @"654321"; [products addObject:product]; UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController; UINavigationController *navigationController = [[tabBarController viewControllers] objectAtIndex:0]; ProductsViewController *productsViewController = [[navigationController viewControllers] objectAtIndex:0]; productsViewController.products = products; return YES; } </code></pre> <p>And finally in the ProductViewController.h:</p> <pre><code>#pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.products count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ProductCell"]; Product *product = [self.products objectAtIndex:indexPath.row]; cell.textLabel.text = product.name; cell.detailTextLabel.text = product.number; return cell; } </code></pre> <p>I really don't know where to look for the error.</p> <p>Thank you very much!</p> <p>Granit</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload