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

  • Home
  • SEARCH
  • 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 8452697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:34:02+00:00 2026-06-10T11:34:02+00:00

Recently I have come across a problem in an app that I am developing.

  • 0

Recently I have come across a problem in an app that I am developing. The app is crashing with EXC_BAD_ACCESS. This doesn’t make sense because auto-reference-counting is turned on.

In the app, I have a button that is linked to an IBAction that displays a GKPeerPickerController.

-(IBAction)showPicker:(id)sender
{
picker = [[GKPeerPickerController alloc ] init];
picker.delegate = self;
picker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;

[picker show];
}

This doesn’t make sense because if I try to manage the memory with calls such as release, it will give me an error saying that ARC disables that call. So as far as I know there is nothing I can do about it. When it crashes, the EXC_BAD_ACCESS is on the line that allocates and initializes the GKPeerPickerController.

  • 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-06-10T11:34:03+00:00Added an answer on June 10, 2026 at 11:34 am

    Does this only happen the second time you try to launch the GKPeerPicker?

    EXC_BAD_ACCESS is thrown when your app tries to access a memory location which it doesn’t ‘own’. This can happen in numerous different ways, even with ARC, which makes it a hard crash to diagnose.

    Check out this question for e.g. EXC_BAD_ACCESS (SIGSEGV) crash – using NSZombies could be a way to track what’s going on.

    However, a little more understanding of what’s going on might help you to understand this crash and fix it.

    The first question is – how is it possible to get EXC_BAD_ACCESS when we’re merely assigning a newly allocated object? Well – the ‘magic of ARC’ is coming in to play here… That simple assignment statement is assigning a new object to an instance variable. The compiler will see that and say – Ah… that ivar might already have an object assigned to it, in which case I’d better release it… So it will add some code for you to check for nil and release the ivar, before it assigns the new value.

    So – I find it unlikely that the alloc/init is causing your problem, and more likely that it’s whatever is currently stored in your picker ivar… What happens if you make picker a local variable instead of an ivar?

    -(IBAction)showPicker:(id)sender
    {
         GKPeerPickerController *localPicker = [[GKPeerPickerController alloc ] init];
         localPicker.delegate = self;
         localPicker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;
    
         [localPicker show];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have never come across this issue but most recently I noticed that a
I have recently come across a problem that I cannot seem to solve. I
My co-worker and I have come across this warning message a couple times recently.
Sometimes I have come across this issue that whenever I change the order of
Ive come across a nice problem recently, I have a Map LinkedHashMap<String, List<MyCustomObject>> I
Recently I have come across a curious pattern in some code. We know that
If I come across old code that does if (!this) return; in an app,
I have a Magento 1.5.0.1 site and have recently come across a problem which
Recently i have come across this statement : InputStream in = new FileInputStream(Filename); What
I'm teaching myself VB.Net. Here is a problem I have recently come across. Say

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.