It is showing exception (signal sigabert) at return UIApplicationMain(argc, argv, nil, NSStringFromClass([xyzAppDelegate class]));
EXCEPTION DETAIL IS: 2015-02-19 13:09:02.825 try11feb2[377:11303] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSArrayM insertObject:atIndex:]: object cannot be nil' *** First throw call stack: (0x1c92012 0x10cfe7e 0x1c45b6a 0x1c45a20 0x26ab 0xbd5589 0xbd3652 0xbd489a 0xbd360d 0xbd3785 0xb20a68 0x46156dc 0x4613bb3 0x4651cda 0x1c348fd 0x465235c 0x46522d5 0x453c250 0x1c15f3f 0x1c1596f 0x1c38734 0x1c37f44 0x1c37e1b 0x1bec7e3 0x1bec668 0x13ffc 0x1c3d 0x1b65 0x1) libc++abi.dylib: terminate called throwing an exception (lldb)
import "xyzViewController.h"
@interface xyzViewController ()
@end
@implementation xyzViewController
@synthesize mytv;
- (void)viewDidLoad
{
tabledata=[[NSMutableArray alloc]init];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)btnpressed:(id)sender {
NSString *str=@"http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/json";
NSURL *url=[[NSURL alloc]initWithString:str];
NSURLRequest *req=[[NSURLRequest alloc]initWithURL:url];
conn=[[NSURLConnection alloc]initWithRequest:req delegate:self];
if (conn) {
webdata=[[NSMutableData alloc]init];
}
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
[webdata setLength:0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[webdata appendData:data];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"failed");
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSDictionary *ald=[NSJSONSerialization JSONObjectWithData:webdata options:0 error:Nil];
NSDictionary *feed=[ald objectForKey:@"feed"];
NSArray *arrayofentry=[feed objectForKey:@"entry"];
for (NSDictionary *dic in arrayofentry)
{ NSDictionary *zero=[dic objectForKey:0];
NSDictionary *title=[zero objectForKey:@"title"];
NSString *label=[title objectForKey:@"label"];
[tabledata addObject:label];
// NSLog(@"%@",label);}
// tabledata =[[NSArray alloc]initWithObjects:label, nil];
[[self mytv]reloadData];
}
[[self mytv]reloadData];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [tabledata count];
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier=@"cell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
cell.textLabel.text=[tabledata objectAtIndex:indexPath.row];
return cell;
}
@end