Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4268246
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:00:37+00:00 2026-05-21T07:00:37+00:00

I have following code in .h file #import <UIKit/UIKit.h> @interface MessDisViewController : UIViewController {

  • 0

I have following code in .h file

#import <UIKit/UIKit.h>


@interface MessDisViewController : UIViewController {
IBOutlet UITableView * DisTable;
NSMutableArray *massages;
UIActivityIndicatorView * activityIndicator;
CGSize cellSize;
NSXMLParser * friendsParser;
NSMutableDictionary * listOfFriends;
NSString * currentElement;
NSMutableString * currentID, * currentFname;
}
-(void) parseXMLFileAtURL:(NSString *) myUrl;
-(UITableViewCell *) getCellContentView:(NSString *)cellIdentifier;
@end

And in .m file I have

#import "MessDisViewController.h"
#import "MessageDetailView.h"

@implementation MessDisViewController


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

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [massages count];
}

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


static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
    cell = [self getCellContentView:CellIdentifier];

UILabel *lblTemp1 = (UILabel *)[cell viewWithTag:1];
UILabel *lblTemp2 = (UILabel *)[cell viewWithTag:2];

int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];

NSString *cellValue = [massages objectAtIndex:indexPath.row];
NSString *title = [[[massages objectAtIndex: storyIndex] objectForKey: @"theme"] stringByReplacingOccurrencesOfString:@"*" withString:@" "];
NSLog(@"%@",title);
lblTemp1.text = title;
lblTemp2.text= [NSString stringWithFormat:@"%@, %@",[[massages objectAtIndex: storyIndex] objectForKey: @"login"],[[massages objectAtIndex: storyIndex] objectForKey: @"activate_date"]];
[cellValue release];
return cell;

}

- (UITableViewCell *) getCellContentView:(NSString *)cellIdentifier {

CGRect CellFrame = CGRectMake(0, 0, 300, 60);
CGRect Label1Frame = CGRectMake(10, 10, 290, 25);
CGRect Label2Frame = CGRectMake(10, 33, 290, 25);
UILabel *lblTemp;

UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CellFrame reuseIdentifier:cellIdentifier] autorelease];

//Initialize Label with tag 1.
lblTemp = [[UILabel alloc] initWithFrame:Label1Frame];
lblTemp.tag = 1;
[cell.contentView addSubview:lblTemp];
[lblTemp release];

//Initialize Label with tag 2.
lblTemp = [[UILabel alloc] initWithFrame:Label2Frame];
lblTemp.tag = 2;
lblTemp.font = [UIFont boldSystemFontOfSize:12];
lblTemp.textColor = [UIColor lightGrayColor];
[cell.contentView addSubview:lblTemp];
[lblTemp release];

return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

return 60;
}
- (void) parseXMLFileAtURL:(NSString *) URL{    
massages = [[NSMutableArray alloc] init];

NSURL *xmlURL = [NSURL URLWithString:URL];  
friendsParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL];
[friendsParser setDelegate:self];
[friendsParser setShouldProcessNamespaces:NO];
[friendsParser setShouldReportNamespacePrefixes:NO];
[friendsParser setShouldResolveExternalEntities:NO];
[friendsParser parse];

}

- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError {
NSString * errorString = [NSString stringWithFormat:@"Cannot connect to DataBase  (Error code %i )", [parseError code]];
NSLog(@"error parsing XML: %@", errorString);

UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Error loading content" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];
}

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{            
if ([elementName isEqualToString:@"Message"]){
    listOfFriends = [[NSMutableDictionary alloc] init];
    [listOfFriends setObject:[attributeDict objectForKey:@"theme"] forKey:@"theme"];
    [listOfFriends setObject:[attributeDict objectForKey:@"login"] forKey:@"login"];
    [listOfFriends setObject:[attributeDict objectForKey:@"activate_date"] forKey:@"activate_date"];
    [listOfFriends setObject:[attributeDict objectForKey:@"message_id"] forKey:@"message_id"];
    [massages addObject:[listOfFriends copy]];
}
}   

- (void)viewDidAppear:(BOOL)animated {
 [super viewDidAppear:animated];
NSString *request=[NSString stringWithFormat: @"http://blablabla"];
[self parseXMLFileAtURL:request];

}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
NSString *mesid = [[NSString alloc] initWithString:[[massages objectAtIndex: storyIndex] objectForKey: @"message_id"]];
NSLog(@"%@",mesid);
MessageDetailView *mesdet = [[MessageDetailView alloc]initWithNibName:nil bundle:nil];
mesdet.modalTransitionStyle=UIModalTransitionStyleCrossDissolve;
mesdet.mesid=mesid;
[self presentModalViewController:mesdet animated:YES];

[mesdet release];
mesdet = nil;
}

- (void)parserDidEndDocument:(NSXMLParser *)parser {

[activityIndicator stopAnimating];
[activityIndicator removeFromSuperview];

NSLog(@"all done!");
NSLog(@"stories array has %d items", [massages count]);
[DisTable reloadData];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}



- (void)dealloc {


[friendsParser release];
[listOfFriends release];    
[super dealloc];
}

@end

When I scrolling down my tableview on simulator it have EXT_BAD_ACCESS why it happen and how to solve this problem

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:00:38+00:00Added an answer on May 21, 2026 at 7:00 am

    Enable NSZombie and test what is creating the error first

    Double-click an executable in the Executables group of your Xcode project.
    Click the Arguments tab.
    In the "Variables to be set in the environment:" section, make a variable called "NSZombieEnabled" and set its value to "YES". 
    

    good luck

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in .py file: import re regex = re.compile( rULLAT:\
I've the following code in my displayandmove.as file: package { import flash.display.MovieClip; public class
If I try executing the following code f = file('test','rb') fout = file('test.out','wb') for
I have following directory structure: / package/ subpackage/ __init__.py file.py __init__.py file.py main.py /package/subpackage/__init__.py
I have the following Java code which will search in an xml for a
I have a file that was encrypted using AES. I use the following NSData
hi all i get bit rate from the following code . i have a
I use the following code to record audio files and play. I have a
Please refer to the following code: Filename: myclass.h @interface myclass:NSObject ... @end @interface NSObject(CategoryName)
I have gone through the following question. Objective C - Where do you dealloc

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.