1

I'm beginer in Objective-C and iOS word, I try to learn how to do nice apps for iOS.

I try to create a TableViewController, so I make a class, but I have some problem with this code, and I don't know why. I describe all in the code in the comments.

This is Code.

BooksTableViewController.m 

import "BooksTableViewController.h"

@implementation BooksTableViewController



- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil //Semantic Issue - Designated initializer missing a 'super' call to a designated initializer of the super class
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];// Parse Issue - Expected expression

if(self){
    self.title = @"Books";
    self.tabBarItem.image = [UIImage imageNamed:@"books8.png"];
    self.imiona = @[@"Pan Tadeusz", @"Potop", @"Lalka", @"Uczta dla wron", @"Symfonnia C++"];
}
return self;
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.imiona.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Title"];

if(cell == nil){
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Title"];
}

cell.textLabel.text = self.imiona[indexPath.row];

return cell; 
}

@end

Thank You for help !

Patryk
  • 377
  • 2
  • 19
  • 2
    Change this line `self = [super initWithNibName:<#nibNameOrNil#> bundle:nibBundleOrNil];` to `self = [super initWithNibName: nibNameOrNil bundle:nibBundleOrNil];` – Vijay Masiwal May 05 '15 at 14:08
  • Alos try to write this code `self.title = @"Books"; self.tabBarItem.image = [UIImage imageNamed:@"books8.png"]; self.imiona = @[@"Pan Tadeusz", @"Potop", @"Lalka", @"Uczta dla wron", @"Symfonnia C++"];` on 'viewDidLoad' function – Vijay Masiwal May 05 '15 at 14:11
  • Error disappeared, but now in this instead of that there is a "Thread 1:breakpoint 1.1" and application can't run. What is the problem ? – Patryk May 05 '15 at 14:16
  • Have you added any breakpoints? Please remove the breakpoints and run again. If I am getting wrong than please share the screenshot of the error – Vijay Masiwal May 05 '15 at 14:18
  • I had a two symulator opened, so that was the problem with brakeponint. Thank You a lot for Your help :) – Patryk May 05 '15 at 14:24
  • Your always welcome :) If you want you can hit up for my comments :P – Vijay Masiwal May 05 '15 at 14:30
  • @VijayMasiwal The problem with BreakPoint already exists, unfotunately I have no idea what is wrong, and why it stops app over here. BTW, how to hit up a comments ? – Patryk May 06 '15 at 11:17
  • When app stops are you getting any console logs? To hit up you can press up icon on front of the comment line when you drag your mouse over it. – Vijay Masiwal May 06 '15 at 11:22
  • http://imageshack.com/a/img911/5400/lar0sr.png This is screen of my xcode. – Patryk May 06 '15 at 11:29
  • This is a breakpoint you can see in blue colour. This is used to debug the code. You can disable or enable this any time. Just tap on the blue icon to disable it, again tap on it to enable. For more information here is the link : http://stackoverflow.com/questions/1665744/xcode-remove-all-breakpoints – Vijay Masiwal May 06 '15 at 11:43
  • Ok, it is work fine :) BTW, when hold mose over Yours comments, I can't see arrow or tick, nothing appear, I want give You a hit Your comment, but I don't know how :/ Sorry for my ignorance :( – Patryk May 06 '15 at 11:53
  • No problem enjoy coding :) – Vijay Masiwal May 06 '15 at 11:54

2 Answers2

0

In initWithNibName at nimNameOrNil there is the problem. All you have to do is: Change this line

self = [super initWithNibName:<#nibNameOrNil#> bundle:nibBundleOrNil]; 

to

self = [super initWithNibName: nibNameOrNil bundle:nibBundleOrNil];

Notice: the <#nibNameOrNil#> with nibNameOrNil

Jessica
  • 9,379
  • 14
  • 65
  • 136
  • I have `self = [super initWithNibName: nibNameOrNil bundle:nibBundleOrNil]; ` this version with `<#nibNameOrNil#>` is after copy from xcode, in this place instead of this errors, I have a breakpoint, and app can build but can't load , it stops at the begin. What is wrong over here ? I don't catch it – Patryk May 06 '15 at 11:12
-1

<#nibNameOrNil#> is from the code sense auto fill. You'll note that the text in Xcode is gray. You need to type nibNameOrNil over it. Seems like an Xcode bug.

Rick Clark
  • 33
  • 1
  • 6