简体   繁体   中英

Program received signal: “EXC_BAD_ACCESS”

I am totally lost here.

I have google analytics in my application to see how many users goto the detailview from my UITableView

i added the Google Analytics code in the viewDidLoad method as follows

- (void)viewDidLoad {
    /*
    some code
    */

    NSError *error;
    [[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-********-*" dispatchPeriod:10 delegate:nil];     
    if (![[GANTracker sharedTracker] trackPageview:@"/DetailView" withError:&error]) {
    // Handle error here
    NSLog(@"Track Detail PageView Error %@ %@",error,[error userInfo]);
    }
}

When i try the app on my device, the app freezes showing the following error.

ERROR

Program received signal:  “EXC_BAD_ACCESS”.
Xcode could not locate source file: GANTracker.m (line: 245)

I just cannot understand the error because there is no file called GANTracker.m in the google analytics package.

Another strange thing this error does not happen always, happens once in 10 times or something.

Its a library file and a header file.

Can some1 help me out?

EXC_BAD_ACCESS happened when you try to send a message to a variable already release. You didn't show enough code so I think you should check this point.

  • You should call [[GANTracker sharedTracker] startTrackerWithAccountID one time in you application not every time when user opens the View. Move this code to - (void)applicationDidFinishLaunching:(UIApplication *)application
  • Release GANTracker when you application stop running.

This is tutorial

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM