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

  • SEARCH
  • Home
  • 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 8730305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:59:38+00:00 2026-06-13T08:59:38+00:00

hy there i have a bit of a problem. i have done an app

  • 0

hy there i have a bit of a problem. i have done an app that reads from xml and displays images. the app is working great on the simulator but sometimes the app does crash on iphone 4. What could it be ? Is there something wrong whit my treating or is the problem somewhere else ? the code is bellow. thank you

-(void)waiting{
    // replace right bar button 'refresh' with spinner

    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    spinner.center = CGPointMake(self.view.bounds.size.width/2, (self.view.bounds.size.height/2)-50);
    spinner.hidesWhenStopped = YES;
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:spinner];
    [spinner startAnimating];
    // how we stop refresh from freezing the main UI thread
    dispatch_queue_t downloadQueue = dispatch_queue_create("downloader", NULL);
    dispatch_async(downloadQueue, ^{

        // do our long running process here
        [NSThread sleepForTimeInterval:0.2];

        // do any UI stuff on the main UI thread
        dispatch_async(dispatch_get_main_queue(), ^{
            [self start];


            [self picture];
            [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(animate) userInfo:nil repeats:YES];


            [spinner stopAnimating];

        });


    });

    dispatch_release(downloadQueue);

}

-(void)start{
    xmlElementObjects = [[NSMutableArray alloc] init];

    parser = [[NSXMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.i-store.si/Storage/Images/app/galerija.xml"]];
    [parser setDelegate:self];
    [parser parse];

}

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
    if(![elementName compare:@"PictureInfo"])
    {
        array = [[NSMutableArray alloc] init];

    }

    else if(![elementName compare:@"imageURL"])
    {
        currentAttribute = [NSMutableString string];
    }

    else if(![elementName compare:@"imageTitle"])
    {
        currentAttribute = [NSMutableString string];
    }
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{

    if(![elementName compare:@"PictureInfo"])
    {
    }

    else if(![elementName compare:@"imageURL"])
    {

        [array addObject:currentAttribute];
        pictures=pictures+1;
        currentAttribute = nil;


    }

    else if(![elementName compare:@"imageTitle"])
    {

    }

    else if(![elementName compare:@"Pictures"])
    {

    }
}


- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
    if(self.currentAttribute)
    {
        [self.currentAttribute appendString:string];
    }
}

UPDATE:
I try Bugsense and this is what i got:

CLASS:
SIGNAL

FILE:
_mh_execute_header +

0libobjc.A.dylib 0x31946fbc objc_msgSend + 15
1Foundation 0x31da161d __NSFireTimer + 144
2CoreFoundation 0x37e3aa63 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
3CoreFoundation 0x37e3a6c9 __CFRunLoopDoTimer + 364
4CoreFoundation 0x37e3929f __CFRunLoopRun + 1206
5CoreFoundation 0x37dbc4dd CFRunLoopRunSpecific + 300
6CoreFoundation 0x37dbc3a5 CFRunLoopRunInMode + 104
7GraphicsServices 0x3793afcd GSEventRunModal + 156
8UIKit 0x3524c743 UIApplicationMain + 1090
9My_app 0x0000273b _mh_execute_header + 5947
  • 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-06-13T08:59:40+00:00Added an answer on June 13, 2026 at 8:59 am

    You cannot schedule the NSTimer on the main thread with GCD.

    Use:

    [NSTimer timerWithTimeInterval:target:selector:userInfo:repeats:]
    

    .. to create the timer and:

    [[NSRunLoop mainRunLoop] addTimer:forMode:]
    

    .. to add it to the main runLoop.

    For alternatives, check this answer from this question: Run repeating NSTimer with GCD?

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

Sidebar

Related Questions

I have to deploy a C# application on a 64 bit machine though there
There have been a couple of threads on this topic in the past that
I am currently developing an app that reads out SMS/Emails while driving. Many users
I'm having a bit of a problem with moving specific data from one server
Good day, Stack Overflow. I have a homework assignment that I'm working on this
The Facebook connect code is eluding me a bit. I have no problem doing
I'm working on a web app that currently has a table-based layout. Ideally I'd
I have a bit of a problem around here, I just can't get it
Simplifying my problem a bit, I have a set of text files with "records"
I have quite of bit of data that I will be uploading into Google

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.