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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:33:02+00:00 2026-05-17T20:33:02+00:00

I am new to iPhone apps and objective c and I cannot figure out

  • 0

I am new to iPhone apps and objective c and I cannot figure out what is wrong with my method the general idea is that it goes to a plist which contain latitudes and longitudes, takes the data stored in the array that the user enters in a text field, and then outputs a pin at that location. Any suggestions would be greatly appreciated. I have only posted the code for the method, but if having any other part of the application would help in debugging my code then I’d be happy to post it.

-(IBAction) showBus {

[busNum resignFirstResponder];

bus *currentBus = [[bus alloc] init];


NSString *txtFieldData = [[NSString alloc] initWithString: busNum.text];



//get data from plist
NSString *myFile = [[NSBundle mainBundle] pathForResource:@"busLocations" ofType:@"plist"];
NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile: myFile];

[myFile release];

[currentBus setLat:[[dictionary objectForKey:txtFieldData] objectAtIndex:0]];
[currentBus setLong:[[dictionary objectForKey:txtFieldData] objectAtIndex:1]];
//[currentBus setName:[[dictionary objectForKey:txtFieldData] objectAtIndex:2]];

[txtFieldData release];
[dictionary release];

int latit = [[currentBus Lat] intValue];
int longit = [[currentBus Long] intValue];
NSLog(@"latitude is %d and longitude is %d",latit,longit);

/*
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
*/

MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = latit;
region.center.longitude = longit;


region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;

[mapView setRegion:region animated:YES]; 
[mapView setDelegate:self];


DisplayMap *ann = [[DisplayMap alloc] init];

ann.title = @"Bus %@",[currentBus name];
ann.coordinate = region.center; 

[mapView addAnnotation:ann];
//[ann release];



[currentBus release];

}

Thanks for the help

  • 1 1 Answer
  • 2 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-17T20:33:03+00:00Added an answer on May 17, 2026 at 8:33 pm

    You shouldn’t be releasing myFile (you did not allocate it), and you should be releasing ann (you did allocate that).

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

Sidebar

Related Questions

When developing iPhone apps with Xcode 3.2.1/Objective C, which unit test tools are recommended?
I'm completely new to iphone apps. I'm creating an iphone app that is designed
I am new to objective-C and iphone apps. I am accessing SQLite and have
I have a new project which is an iPhone application. for that I have
I am new to iPhone apps, I am developing one application which requires playing
i am new to iphone apps development.i want to develop Iphone applicaiton.which version i
I am new to developing iPhone apps, and wanted to be sure that I
I am new to Iphone apps and I am trying to build a tab
I am new to using the SQLite database in iphone apps. I have created
I’m writing a new iPhone app which doesn’t depend on any of the 3.0

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.