objective c - [__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance -
I am trying to parse a Jason file in the table view and I am getting this error
[__NSCFDictionary objectAtIndex:]: unrecognized happening selector sent to instance and App crashing please help me, I'm new to iOS development
my code
@implementation ViewController - (id) initWithNibName:. (NSString *) nibNameOrNil Bundle: (NSBundle *) NibBundleOrNil {self = [super initWithNibName: nibNameOrNil Bundle: nibBundleOrNil]; If (self) {// custom initialization} back itself; } - (zero) viewDidload {self.title = @ "Feeds"; [Super viewedload]; [UIApplication ShareApp] .networkActivityIndicatorVisible = YES; NSURL * url = [NSURL URLWithString: @ "http://little-people.blogspot.com/feeds/posts/default? alt = json"]; NSURLRequest * Request = [NSURL request request with url: url]; [[NSUr Connection Elok] Init VectorQuest: Request Rep: Self]; } - (zero) connection: (NSURLConnection *) connection didReceiveResponse: (NSURLResponse *) response {data = [[NSMutableData alloc] init]; NSLog (@ "data data,% @", data); } - (zero) connection: (NSURLConnection *) connection was the receipt data: (NSDT * *) The Data {[DataApendance: Datata]; } - (zero) connectionDifffish: Loading: (NSURL connection connection *) connection [[UIApplication shared application] .networkActivityIndicatorVisible = NO; Feed = [NSJSANSIASization JSONObjectWithData: data option: kNilOptions error: zero]; NSLog (@ "data,% @", feed); [Main television reload data]; } - (void) connection: (NSURLConnection *) connection didFailWithError: (NSError *) error {UIAlertView * errorView = [[UIAlertView alloc] initWithTitle: @ "error" message: @ "The download could not complete - make sure you ' Again, be connected to 3G or Wi-Fi. "Representative: Cancel zeroTuttonite: @" Dismiss "other buttonTitle: zero]; [Show error view]; [UIApplication share application] .networkActivityIndicatorVisible = NO; } - (int) numberOfSectionsInTableView: (UITableView *) tableview {return1; } - (int) Table view: (UITableView *) table view numberofrose injection: (NSInteger) section {return [feed count]; NSLog (@ "data data,% @", feeds); } - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: @ "MainCell"]; If (cell == null) {cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier: @ "MainCell"]; } If (([feed count] - 1) & gt; = indexPath.row) {cell.textLabel.text = [[feed objectAtIndex: indexPath.row] objectForKey: @ "feed"]; Cell.detailTextLabel.text = [[Feed object atindex: indexpath.ro] objectfore: @ "title"]; } Return cell; The problem is that feeds a NSArray , but a nsDictionary . Looking at JSON, you might want to use this array: [feed objectForKey: @ "entry"]
Comments
Post a Comment