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 6702297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:02:16+00:00 2026-05-26T07:02:16+00:00

I am a little confused, and after countless attempts and read several articles I

  • 0

I am a little confused, and after countless attempts and read several articles I decided to write.
my problem is that if you call a method from a class (xml) and it is aimed at viewcontroller all goes well
but if I might add [self.view add…] it back to the top reloading the viewDidLoad of the viewController class entering into an endless loop.

this is what I do

class (ViewController)
.h

#import <UIKit/UIKit.h>

@class  XMLStuff;

@interface skiSpeedViewController : UIViewController {
}

@property (nonatomic, retain) XMLStuff *xml;

.m

- (void)viewDidLoad
{
    [super viewDidLoad];

    xml.skiSpeedC = self;

    GpsStuff *gps = [GpsStuff alloc];
    [gps init];
}

gps.m

- (id)init
{
    self = [super init];
    if (self) {
        xml = [XMLStuff alloc];
}
}
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
     [xml lon:newLocation.coordinate.longitude lat:newLocation.coordinate.latitude];

xml.h

#import "skiSpeedViewController.h"

@class skiSpeedViewController;

@interface XMLStuff : NSObject <NSXMLParserDelegate> {
}

@property (retain, nonatomic) skiSpeedViewController *skiSpeedC;

.m

   @synthesize skiSpeedC;

- (void) parserDidEndDocument:(NSXMLParser *)parser {
NSLog(@"--%@", self.skiSpeedC); // Return (null)
[self.skiSpeedC riceviDic:datiMeteo];
}

ViewController.m

    -(void)riceviDic:(NSMutableDictionary *)dictMeteo {
        datiMeteo = [[NSMutableDictionary alloc]initWithDictionary:dictMeteo];
    }
}
  • 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-26T07:02:17+00:00Added an answer on May 26, 2026 at 7:02 am
    - (void) parserDidEndDocument:(NSXMLParser *)parser {
        classViewController *skiSpeedC = [classViewController alloc];
        [skiSpeedC riceviDic:datiMeteo];
    }
    

    You are creating a new instance of classViewController every time. Your “xml” class (XMLStuff?) should have a pointer to the view controller and be calling the riceviDic method on that instance.

    You’re getting an infinite loop because when you allocate the XML object in viewDidLoad, it too starts parsing the XML, then creates more XML objects, which then create more viewControllers…

    So, add a property to XMLStuff of type classViewController, and when you create it in viewDidLoad:

    xml.skiSpeedC = self;
    

    Then, in parserDidEndDocument:

    - (void) parserDidEndDocument:(NSXMLParser *)parser {
        [self.skiSpeedC riceviDic:datiMeteo];
    }
    

    UPDATE

    OK, after your edit things look very different – you seem to have introduced a new class – GpsStuff, which has its own instance of XMLStuff (and a dodgy looking init method which I assume you haven’t copied in properly?). Which one is actually parsing your document? XMLStuff in your view controller, or in GPSStufF? I’m guessing the one in GPSStuff, which you haven’t set the skiSpeedC property for. I was previously assuming that you were calling everything from your view controller.

    Why not remove the creation of a new XMLStuff object from GPSStuff, and when you create GPSStuff in your view controller, pass the xml object you’ve created into it:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        GpsStuff *gps = [[GpsStuff alloc] init];
        XMLStuff *xml = [[XMLStuff alloc] init];
        xml.skiSpeedC = self;
        gps.xml = xml;
        [xml release];
    }
    

    Also, the skiSpeedC property should probably not be retain, since it is essentially a delegate assignment and the view controller is not going to be released before you release the xml parser.

    As a note, by convention you should be initializing objects like this:

    GPSStuff *gps = [[GPSStuff alloc] init];
    

    Not on two lines. You want what is returned from init to be assigned to your variable.

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

Sidebar

Related Questions

Started learning Wicket after ASP.NET MVC and feel a little bit confused about managing
I am a little confused on how exactly postScale method calculates the values of
I am a little confused about setting NTFS Permissions to a directory after I
I'm getting a little confused how to set up a class that's two steps
I'm a little confused about how to do something that I thought would be
Hello I am just a little confused after reading these materials on Tasks and
I'm a little bit confused now after I've seen a code snippet for iPhone
I'm a little confused on creating a DependencyProperty for properties that depend on external
I am little confused regarding this matter. I understand that VS had a SPA
I'm a little confused how to do this, basically I have a page that

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.