1

I have already found the same question, but answers haven't helped me :( Maybe because I have specific problem. After installing app to iPhone 4S(iOS 5) some problems appear. I already fix couple of them, but this one more stubborn the it seems at first sight.

I opened existing Xcode3 project in Xcode4 and this problem appeared.

I will put some code here:

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    // Return the number of sections.       
     return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.

    return [self.townShopsArray count];
}

I checked: self.townShopsArray is not empty

function:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ...

is not called, so I don't need to put its code here.

Can anyone tell me what could went wrong when I upgraded project from Xcode 3 to Xcode 4?

Neo
  • 2,807
  • 1
  • 16
  • 18
dejan
  • 11
  • 1
  • did you add the tableView delegate and datasource? – Neo Oct 02 '12 at 07:45
  • when I open .xib file and select tableview, then right click on it, I can see this: in outlets section: - dataSource: File,s owner - delegate: File's owner in Referencing outlets: - view:File's owner does this mean that tableView's delegate and datasource is properly set? – dejan Oct 02 '12 at 08:21

1 Answers1

1

Here are the possible reasons:

  • Your UITableView's data source isn't set to this controller
  • Your UIViewController / UITableViewController's class is not set to the class of this view controller in the Identity Inspector of Interface Builder. If this isn't set, iOS will ask the generic UITableView class for info about your cell, rather than the class you make. Custom Class

  • (If you added the UITableView programmatically)... your pointer to the table isn't strong, and the UITableView has been deallocated

Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
  • But it works fine in Xcode 3 / iOS 4 simulator and in Xcode 4 / iOS 5 simulator / iPhone4s doesn't. How is this possible? – dejan Oct 02 '12 at 08:09
  • And, I checked in debugger: datasource od tableView is set to this controller. Second reason could be true, but I don't know how to check this (I said I am newbie:( ) tableView is added in ui builder – dejan Oct 02 '12 at 08:12
  • I think the Xcode version is probably a red herring. Maybe a setting change. Can you upload your Xcode project somewhere so we can take a look at it? I'll update my answer for #2 with a picture of where this is set. – Aaron Brager Oct 02 '12 at 12:57