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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:40:20+00:00 2026-05-27T04:40:20+00:00

I know this is a very stupid question to ask but i have a

  • 0

I know this is a very stupid question to ask but i have a view controller which has a mapview in it and some uibuttons i have done every thng to eliminate all the leaks bt still after 2-3 toggle between two controller app crashs. Below is the code for allocation and dellocation. BTW i dont get any “did recive memoru warning”.. Thnx alot

.h/

@interface MapView : BaseViewController <MKMapViewDelegate,MKAnnotation> {

    MKMapView *mapView;
    NSMutableArray *placeName;
    NSString *mid;
    UISegmentedControl *segmentedControl;
    IBOutlet UILabel *numberofbeeps;
    NSInteger badgenumber;
}
@property (nonatomic, retain) UILabel *numberofbeeps;
@property(nonatomic, retain) NSString *mid;
@property (nonatomic, retain) IBOutlet MKMapView *mapView;
@property(nonatomic,retain) NSMutableArray *placeName;
@property (nonatomic,retain) IBOutlet UISegmentedControl *segmentedControl;


-(IBAction)refreshButtonPressed:(id)sender;

-(IBAction) segmentedControlIndexChanged;
-(IBAction)SignUpButtonPressed:(id)sender;
-(IBAction)BackButtonPressed:(id)sender;
-(IBAction)AddBeepButtonPressed:(id)sender;
-(id)initWithAnnotation:(id ) annotation;
-(IBAction)sliderChanged:(id)sender;
-(IBAction)MyAccountPageButtonPressed:(id)sender;
-(IBAction)MyBeepsButtonPressed:(id)sender;

@end

.m/

    -(void)network:(WNetwork*)network didFinishLoadingWithRequest:(NSInteger)pReq data:(NSMutableDictionary*)pData
{
    [self removeLoader];

    switch (pReq) {
        case JBJsonParser:
        {

            NSMutableArray *array = [NSMutableArray new];
            self.placeName = array;
            [array release];


            self.placeName = pData;



            badgenumber = [placeName count];

                NSString *checkstring = [[AppHelper mDataManager] objectForKey:@"numberofbeepsnearby"];


            NSInteger check = [checkstring intValue];

            switch (check) {
                case 0:
                {
                    self.numberofbeeps.text =[NSString stringWithFormat:@"No beeps found nearby. Why not beep something?"];
                    NSLog(@"%@",checkstring);
                }
                    break;
                case 1:
                {

                    self.numberofbeeps.text =[NSString stringWithFormat:@"%@ beep found nearby! %d beeps worldwide.",checkstring,badgenumber];
                    NSLog(@"%@",checkstring);
                }
                    break;

                default:
                {
                    self.numberofbeeps.text =[NSString stringWithFormat:@"%@ beeps found nearby! %d beeps worldwide.",checkstring,badgenumber];
                    NSLog(@"%@",checkstring);
                }
                    break;
            }

            if ([placeName count])
            {
                for (int i =0; i < [placeName count]; i++) 
                {
                    NSDictionary *dict  = [placeName objectAtIndex:i];

                    CLLocationCoordinate2D coordinatemain;
                    coordinatemain.latitude = [[dict objectForKey:@"Lat"] doubleValue];
                    coordinatemain.longitude = [[dict objectForKey:@"long"] doubleValue];

                    DLog(@"id of Beeps %@", mid);

                    NSString *username = [NSString stringWithFormat:@"by %@",[dict objectForKey:@"username"]];
                    MyAnnotation *ann = [[MyAnnotation alloc] init];

                    ann.title = [dict objectForKey:@"beep"];

                    ann.subtitle = username;
                    ann.beepid=[dict objectForKey:@"beepid"];
                    ann.coordinate = coordinatemain;
                    ann.coordinate.latitude == [[dict objectForKey:@"Lat"] doubleValue];
                    ann.coordinate.longitude == [[dict objectForKey:@"long"] doubleValue];
                    [mapView addAnnotation:ann];
                    [ann release];

                }
            }





        }

            break;

        default:
            break;
    }

}



-(IBAction) segmentedControlIndexChanged{

    switch (self.segmentedControl.selectedSegmentIndex) {

        case 0:

        {   
            Screen1 *objCont = [[Screen1 alloc] initWithNibName:@"Screen1" bundle:nil];
            objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
            [self presentModalViewController: objCont animated: YES];
            [objCont release];
        }
            break;

        case 1:
        {

            MapView *objCont = [[MapView alloc] initWithNibName:@"MapView" bundle:nil];
            objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
            [self presentModalViewController: objCont animated: YES];
            [objCont release];


        }
            break;



        default:

            break;

    }

}
#pragma mark -
#pragma mark request delegates
-(void)makeAccomodationRequest
{


    NSMutableDictionary *paramDic = [[NSMutableDictionary alloc] init];


    [self.mWNetowrk makeRequsetWithURL:URL_Showbeepsmap type:JBJsonParser paramDictionary:paramDic delegate:self];
    [paramDic autorelease];
}

-(BOOL)network:(WNetwork*)network shouldStartForRequest:(NSInteger)pReq
{
    [self addLoaderWithtext:@"Loading"];


    return YES;
}

-(void)network:(WNetwork*)network didFailForRequest:(NSInteger)pReq WithError:(NSString*)error
{
    [AppHelper showAlert:error];
    [self removeLoader];
}



-(void)initializeView
{
    [self initializeOutlets];
    [self makeAccomodationRequest];

}
-(void)initializeOutlets
{
}


-(IBAction)BackButtonPressed:(id)sender
{
    Screen1 *objCont = [[Screen1 alloc] initWithNibName:@"Screen1" bundle:nil];
    objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController: objCont animated: YES];
    [objCont release];

}

-(IBAction)refreshButtonPressed:(id)sender
{
    MapView *objCont = [[MapView alloc] initWithNibName:@"MapView" bundle:nil];
    objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController: objCont animated: YES];
    [objCont release];


}
-(IBAction)MyAccountPageButtonPressed:(id)sender
{

    NSString *sid = [[AppHelper mDataManager] objectForKey:@"logout"];


    {
        NSDecimalNumber *session = [[AppHelper mDataManager] objectForKey:@"sid"];
        if ([sid isEqualToString:@"logged out"]||session==NULL) {



            AddPlace *objCont = [[AddPlace alloc] initWithNibName:@"AddPlace" bundle:nil];
            objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve ;
            [self presentModalViewController: objCont animated: YES];
            [objCont release];

        }

        else {

            MyAccountPage *objCont = [[MyAccountPage alloc] initWithNibName:@"MyAccountPage" bundle:nil];
            objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve ;
            [self presentModalViewController: objCont animated: YES];
            [objCont release];

        }



    }

}
-(IBAction)MyBeepsButtonPressed:(id)sender
{


    NSString *sid = [[AppHelper mDataManager] objectForKey:@"logout"];
    NSDecimalNumber *session = [[AppHelper mDataManager] objectForKey:@"sid"];
    //NSString *sessionStr = [session stringValue]; 
    if ([sid isEqualToString:@"logged out"]||session==NULL) {

        [[AppHelper mDataManager] setValue:@"MyBeeps" forKey:@"appflow"];
        AddPlace *objCont = [[AddPlace alloc] initWithNibName:@"AddPlace" bundle:nil];
        objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve ;
        [self presentModalViewController: objCont animated: YES];
        [objCont release];


    }

    else {


        MyBeeps1 *objCont = [[MyBeeps1 alloc] initWithNibName:@"MyBeeps1" bundle:nil];
        objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve ;
        [self presentModalViewController: objCont animated: YES];
        [objCont release];
    }

}
-(IBAction)AddBeepButtonPressed:(id)sender
{
    NSString *sid = [[AppHelper mDataManager] objectForKey:@"logout"];
    NSDecimalNumber *session = [[AppHelper mDataManager] objectForKey:@"sid"];


    if([sid isEqualToString:@"logged out"]||session==NULL) {


        [[AppHelper mDataManager] setValue:@"Addabeep" forKey:@"appflow"];
        AddPlace *objCont = [[AddPlace alloc] initWithNibName:@"AddPlace" bundle:nil];
        objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve ;
        [self presentModalViewController: objCont animated: YES];
        [objCont release];
    }

    else {
        [[AppHelper mDataManager] setValue:@"Addabeep" forKey:@"appflow"];
        Check20M *objCont = [[Check20M alloc] initWithNibName:@"Check20M" bundle:nil];
        objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve ;
        [self presentModalViewController: objCont animated: YES];
        [objCont release];  



    }


}


#pragma mark -

#pragma mark MKMapViewDelegate

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{

    if (annotation == mapView.userLocation) {
        //  NSLog(@"nil");
        return nil; }



    MKPinAnnotationView *pinView = nil;

    static NSString *defaultPinID = @"com.invasivecode.pin";
    pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];




    if ( pinView == nil )
        pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
    pinView.pinColor = MKPinAnnotationColorGreen;
    pinView.frame=CGRectMake(0, 0, 30, 30);
    pinView.canShowCallout = YES;
    pinView.animatesDrop = YES;


    UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    MyAnnotation *temp =  (MyAnnotation*)annotation;
    infoButton.tag   = [temp.beepid integerValue];
    [infoButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
    pinView.rightCalloutAccessoryView = infoButton;
    [defaultPinID release];

    return pinView;
}



-(IBAction)showDetails:(id)sender{

    UIButton *button = (UIButton*)sender    ;

    NSLog(@"Annotation Click");


    BeepsDetail *objCont = [[BeepsDetail alloc] initWithNibName:@"BeepsDetail" bundle:nil];
    objCont.mId = [NSString stringWithFormat:@"%d",button.tag];
    objCont.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController: objCont animated: YES];

    [objCont release];

}


#pragma mark -
#pragma mark mapView delegates
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {

}
return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    mapView.delegate = self;
    [self initializeView];
    mapView.showsUserLocation = YES;

    [self makeAccomodationRequest];


    CLLocation *location = [[AppHelper appDelegate] mLatestLocation];
    MKCoordinateRegion region; 
    region.center.latitude = location.coordinate.latitude;

    region.center.longitude =   location.coordinate.longitude;

    region.span.latitudeDelta = 0.001; 

    // Add a little extra space on the sides 
    region.span.longitudeDelta = 0.001;

    // Add a little extra space on the sides 
    region = [mapView regionThatFits:region]; 
    [mapView setRegion:region animated:YES]; 








}

// Listen to change in the userLocation

- (void)viewDidUnload
{

    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    self.mapView = nil;
    self.numberofbeeps =nil;
    self.mapView = nil;
    self.segmentedControl = nil;
}
- (void)dealloc
{
    [mapView release];
   // [self.mapView removeFromSuperview]; 
    [placeName release];
    //[mid autorelease];
    [super dealloc];


}
- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc. that aren't in use.
}




@end
  • 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-27T04:40:21+00:00Added an answer on May 27, 2026 at 4:40 am

    The following only works on the simulator not on device…


    Here is a good procedure for finding bad access errors using zombies. All the tools are built into Xcode.

    First change to profiling. Click and hold one the run button.

    profile

    Now choose zombies. This tool warns you just before you are about to use a deallocated object which would other wise trigger a bad access.

    zombies!

    Now when a zombie is detected you will see something like this (minus annotatios!) using the tools you can see the object lifecycle. Double click to be taken the the code.

    enter image description here

    Hope it helps someone!

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

Sidebar

Related Questions

Right, I know this is a very stupid question, but I have no luck
I know this question is going to sound very stupid but here goes nonetheless.
this is a really stupid question but I have a deadline and I'm very
I know this is very stupid question, but I wanted to clarify this. Let's
I know this might be a very stupid question but I am new to
This is a stupid question, and I know it is, but for some reason
This must be a very stupid newbie question, but I have spent my whole
I know this question is stupid, I searched very hard but still cannot find
I know this is a very broadly scoped question, but what do I need
I know this might be very easy to some,, I have a simple string

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.