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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:14:37+00:00 2026-05-13T01:14:37+00:00

I am trying to perform a simple operation that i have done alot in

  • 0

I am trying to perform a simple operation that i have done alot in this program. I am trying to launch the CLLocationManager once the app is finished launching and get the current location once the update has happened. My app works in that it get the current location, when i NSLog the current location it works fine. The problem is that i am trying to pass this location from one object to another and it does not have a value once it gets there.

I have been looking up accessor methods and everything seems right as i have these types of operations all over my program. I have tried to follow numerous examples but none seem to work.

Here is some code.

This is the .h file of the CLLocationManagerDelegate.

@interface YogaAllianceAppDelegate : NSObject <UIApplicationDelegate,CLLocationManagerDelegate> {

CLLocationManager *locationManager;
    CLLocation *mycurrentLocation;

    float curLats;
    float curLons;
    BOOL locationDidUpdate;

    UIWindow *window;

    YogaAllianceViewController *viewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;  
@property (nonatomic, retain) CLLocationManager *locationManager;
@property (nonatomic, assign) float curLats;
@property (nonatomic, assign) float curLons;
@property (nonatomic, assign) CLLocation *mycurrentLocation;
@property (nonatomic, retain) IBOutlet YogaAllianceViewController *viewController;
@end

This is the .m file

@synthesize viewController, locationManager, curLats, curLons, mycurrentLocation;





- (void)applicationDidFinishLaunching:(UIApplication *)application {    

    self.locationManager = [[[CLLocationManager alloc]init] autorelease];
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    locationManager.delegate = self;
    [locationManager startUpdatingLocation];


    locationDidUpdate = NO;
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];

}


-(void)locationManager: (CLLocationManager *)manager
   didUpdateToLocation: (CLLocation *)newLocation
          fromLocation: (CLLocation *)oldLocation{

    [[NSNotificationCenter defaultCenter]
     postNotificationName:@"currentLocationDidUpdate" object: self];

    [locationManager stopUpdatingLocation];



    NSLog(@"Core Location says location available");


    self.curLats = newLocation.coordinate.latitude;
    self.curLons = newLocation.coordinate.longitude;

    self.mycurrentLocation  = newLocation;


    NSLog(@"current position is then %@", [mycurrentLocation description]);

}

At this point it works. I get the location printed out and everything, but i need that location in another object and it seems that all my attempts at reworking the dot notation has failed.
Here is the . h of the object i need it in.

@interface School_Location_List_Controller : UIViewController {


    CLLocation* currentLocation;    

}

- (IBAction) btnBack_Clicked:(id)sender;


@property (nonatomic, assign) CLLocation* currentLocation;

And here is the .m

@implementation School_Location_List_Controller

@synthesize destinations, closeSchools, currentLocation;



-(void) viewWillAppear: (BOOL)animated {


    NSLog (@"Registered for location events");

    YogaAllianceAppDelegate *updated = [[YogaAllianceAppDelegate alloc]init];


    currentLocation = updated.mycurrentLocation ;



    NSLog(@"current position here in the passed object is %@", [currentLocation description]);


    [super viewWillAppear:animated];
}

It is at this point that i am confused. When i print that out, it just says the currentLocation is Null. Its like it never got the data..

Thank you guys in advance.

  • 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-13T01:14:37+00:00Added an answer on May 13, 2026 at 1:14 am

    Your problem is this line:

    YogaAllianceAppDelegate *updated = [[YogaAllianceAppDelegate alloc]init];
    

    Here, you’re allocating and initializing a brand new object, one that is entirely distinct from the application’s existing delegate. If you want to get the application delegate that already exists, use:

    YogaAllianceAppDelegate *updated = (YogaAllizanceAppDelegate *)[[UIApplication sharedApplication] delegate];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to perform a single boolean NOT operation, it appears that under MS SQL
I'm trying perform a relatively basic TCP socket send/receive operation on Windows CE using
I am trying to perform a JNDI-lookup from within the GWT devmode. I have
I'm trying to perform a DISTINCT clause on a query like this SELECT DISTINCT
I am currently trying to develop a small simulation program in xna that takes
I'm trying to write a fairly simple application that passes data between two sockets.
I am using JDK 7 and I am trying to perform a simple write-to-file
An interruption exception (java.lang.InterruptedException) occurs as I'm trying to perform some simple read (SELECT)
I'm trying to create a simple session cache that allows me to set a
I have found some sample code on codeproject that allows for user impersonation. This

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.