Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode keeps pausing my music

Tags:

xcode

First of all i know this is a programming forums, but my problem concerns Xcode and the problem happens with me while CODING.

When i use Xcode, when it is stopped in breakpoints while debugging the sound of the music played ( in my Mac music player ) is gone !!! i know this is awkward but it happens. Does any one has a solution or at least a reason for this?

After googling this problem i just found one case talking about the same problem here in this Link

I'm not using Spotify like the case in the link i'm using another music player called Vox

I have changed Vox and changed it with Deezer and it has the same problem

Update 1

As mentioned in the Accepted Answer, This problem only happened while using Cocos2dx in Xcode, When i returned back to the use Xcode with just iOS sdk without the Cocos2dx this problem doesn't exist any more.

like image 812
Omar HossamEldin Avatar asked Feb 25 '15 01:02

Omar HossamEldin


People also ask

Why is my Apple Music pausing by itself?

Give your system a reset If you're having a pausing problem consistently, what you want to do is turn off your phone, and wait about 15 seconds, and then turn it back on. Whether this is an android or iPhone device, this always is a helpful way to just give your system a reset and try again.


1 Answers

This is happening when your capture audio session in your application and debug something.

The case to reproduce this using Xcode + simulator (on device you will have phone's audio session, so it can not be reproduced with the following snippet). Sometimes it stops just after breakpoint occurs, sometimes - after about a minute (i think, session expires after that time, or something like that)

Create empty project and override didFinishLaunchingWithOptions

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

   NSError *setCategoryError = nil;
   [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError];
   if (setCategoryError) // set breakpoint here
    NSLog(@"Error setting category! %@", setCategoryError);
     return YES;
}

I think, on breakpoint session somehow stops music playing. so - check your project for the code, which manipulates with audio session (AVAudioSession). Hope, this helps.

like image 197
Doro Avatar answered Nov 02 '22 13:11

Doro