0

I have written an iOS app that gets the microphone input an analyses it. Based on the analysis, The app needs to send a notification to the user. However, when I send the app to the background, the app gets terminated after a few seconds. I have used this link and have set relevant properties in the Info.plist. Specifically the Required background modes key with value App plays audio or streams audio/video using Airplay. Any other things I need to do and missed?

Don't know if relevant but I'm using EZAudio to access the microphone.

nevos
  • 907
  • 1
  • 10
  • 22

2 Answers2

0

I had a similar problem. You also have to enable it in Capabilities to work. Is Background Modes on? If yes, is the Audio and AirPlay option checked?

Project Settings: Project Settings

I hope it helps!

Raphael Silva
  • 401
  • 7
  • 14
  • Just to make sure, after you've made those changes (Plist + Project settings), have you _deleted_ the app from the simulator/device, _deep cleaned_ (Command+Option+Shift+K) and _built_ the project again? – Raphael Silva Apr 28 '15 at 00:27
  • yes I have.. Do you think it might be related to [EZAudio](https://github.com/syedhali/EZAudio)? – nevos Apr 28 '15 at 08:53
  • I don't think so. Have you tried to create a new project? – Raphael Silva Apr 28 '15 at 22:24
0

if you can use EZAudioPlotGL class than change it EZAudioPlot Class it work for me. select EZAudioPlotGL view change only class name of view goto identity inspector and change it EZAudioPlot. after that

@property (nonatomic,weak) IBOutlet EZAudioPlotGL *audioPlot;

Change it

@property (nonatomic,weak) IBOutlet EZAudioPlot *audioPlot;

in AppDelegate.m file change also

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    __block UIBackgroundTaskIdentifier task=0;
    task=[application beginBackgroundTaskWithExpirationHandler:^{
        NSLog(@"Expiration handler called %f",[application backgroundTimeRemaining]);
        [application endBackgroundTask:task];
        task=UIBackgroundTaskInvalid;
    }];
}
sohil
  • 818
  • 2
  • 15
  • 38
  • Is the EZAudioPlotGL doesn't work with background mode? I'm using it because it allows for transparent background.. – nevos Jun 10 '15 at 11:01
  • in my case EZAudioPlotGL doesn't work with background mode. i have use EZaudioPlot. its works fine in background. – sohil Jun 10 '15 at 11:07