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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:00:59+00:00 2026-05-23T15:00:59+00:00

So I am pretty new to object oriented programing, and I am trying to

  • 0

So I am pretty new to object oriented programing, and I am trying to do the following in xcode – I have a MyMap.m view controller where I display your location, and now want to add weather. For this purpose I would like to send the coordinate to a geocoder class that will return first the zipcode. I decided to heat it up with the classes, so created a class which will return the zipcode.

the code in the map controller is:

…..

  MKPlacemark *zip;
    getzip = [[GetZipcode alloc] init]; //ADDED THIS

[getzip reverseGeocodeCurrentLocation];
zip = getzip.myPlacemark;
NSLog(@"Placemark is: %@", zip);

….

where getzip is an instance of a GetZipcode class:

@interface MyMap : UIViewController <MKMapViewDelegate, MyLocationControllerDelegate> {

              GetZipcode *getzip;
 //and more stuff
 }

From some reason, nothing happened when I run this:

[getzip reverseGeocodeCurrentLocation];

which reverseGeocodeCurrentLocation is a function inside the GetZipcode class:

.h

- (void)reverseGeocodeCurrentLocation;

and the .m of that class is:

- (void)reverseGeocodeCurrentLocation
{
self.reverseGeocoder = [[[MKReverseGeocoder alloc] init] autorelease];
reverseGeocoder.delegate = self;
[reverseGeocoder start];
}



- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
PlacemarkViewController *placemarkViewController = [[PlacemarkViewController alloc] initWithNibName:@"PlacemarkViewController" bundle:nil];
placemarkViewController.placemark = placemark;
myPlacemark = placemark;
NSLog(@"Placemark is: %@", placemark.postalCode);
 }

Hope it’s not TMI, but would really appreciate some help here. thanks!

  • 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-23T15:00:59+00:00Added an answer on May 23, 2026 at 3:00 pm

    You didn’t give the MKReverseGeocoder a coordinate to reverse geocode.

    The designated initializer is -[MKReverseGeocoder initWithCoordinate:] through which you supply the coordinate.

    Hope that helps

    (also of course check to see that you created and init’d your GetZipcode instance and that getzip isn’t nil when you try to use it.)

    EDIT:

    You created an instance variable (ivar) called getzip. But you didn’t post any code that creates an instance of GetZipcode and puts that address in the pointer getzip. Somewhere you should have something like:

    getzip = [[GetZipcode alloc] someAppropriateInit];
    

    SECOND EDIT

    So a couple more things to think about here. (1) You can’t actually read the placemark property immediately as you trying to do here:

    zip = getzip.myPlacemark;
    

    It will take some time for a reverse geocoder to go out to the network and do it’s work and figure out the placemark. So you won’t have a placemark until you get the delegate callback:

    - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
    

    (2) You should also implement this callback so you can see if there was a problem finding the placemark:

    - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
    

    (3) Are you sure you are passing a valid coordinate to the reverse geocoder? You may want to log that to be absolutely sure.

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

Sidebar

Related Questions

I'm relatively new to Object Oriented Programming. I pretty much understand the concepts, but
I am pretty new to php, but I am learning! I have a simple
I'm pretty new to regular expressions. I have a requirement to replace spaces in
I am pretty new to programming(just finished University). I have been thought in the
i'm pretty new to jquery. I'm trying to insert an element to the DOM,
Pretty new to dependency injection and I'm trying to figure out if this is
I am pretty new to using object/classes in PHP and I am curious about
guys. I'm pretty new to both Silverlight and WCF. What I'm trying to do
As I am pretty new to ObjC I'm stuck to the following issue: I
I am using django and as I am pretty new I have some questions.

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.