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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:22:12+00:00 2026-06-09T10:22:12+00:00

I have a problem I haven’t been able to solve in 2 days now,

  • 0

I have a problem I haven’t been able to solve in 2 days now, and it only happens in the release build, I dont have any problem when I run it in the debug build.

But I think it is because of a block that isn’t getting executed. I have a crash report like this:

3   libdispatch.dylib               0x375d1c34 _dispatch_Block_copy + 8
4   libdispatch.dylib               0x375dc4ca dispatch_async$VARIANT$up + 6
5   Koldkrigsspionen                0x00020ef2 -[NOAudioManager audioPlayerDidFinishPlaying:successfully:] (NOAudioManager.m:807)

The method of audioPlayerDidFinishPlaying:successfully is like this:

- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
    if (musicPlayerCompletionBlock)
        dispatch_async(dispatch_get_main_queue(), musicPlayerCompletionBlock);
}

Block is set like this:

- (void)setMusicCompletionBlock:(void (^)(void))theBlock 
{ 
    musicPlayerCompletionBlock = theBlock; 
} 

Like this in the header file:

void (^musicPlayerCompletionBlock) (void);
  • 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-09T10:22:13+00:00Added an answer on June 9, 2026 at 10:22 am

    You need to copy the block in your setter. Blocks start out on the stack and don’t move to the heap until copied.

    It “works” in debug builds because the optimizer isn’t enabled and, thus, the compiler doesn’t aggressively reuse the stack. I.e. it works by coincidence. If you were to add a method call or two between the blocks creation and invocation, it would likely start crashing.

    I would recommend that you get rid of the custom implementations of the setter/getter for musicPlayerCompletionBlock and just declare a property:

    typedef void(^MusicCompletionBlockType)(void);
    .... 
    @property(copy) MusicCompletionBlockType musicCompletionBlock;
    

    The generated setter/getter will take care of copying the block. You can release it in dealloc, if not using ARC.

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

Sidebar

Related Questions

I have a little problem that I haven't been able to find a solution
I have a problem that I haven't been able to find a solution to,
I have a silly problem i haven't been able to figure out. Can anyone
I have a problem that I just haven't been able to figure out. I
I have been searching for solutions to my problem but haven't found any that
I have searched for hours now and haven't found a solution for my problem.
I have been searching for a solution to my problem but haven't found anything
Here's a tricky problem I haven't quite been able to get my head around.
I have a simple problem but I haven't had any luck finding the solution
I read a lot of posts about the problem I have, but haven't been

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.