my iphone app was rejected due to microphone perssion issue - iphone

In my app i am capturing picture by using AVCaptureStillImageOutput class.
This method also use AVCaptureSession class which is now by default use AVAudioSession
ref: Apple doc "AVCaptureSession now uses your app’s AVAudioSession by default"
due to AVAudioSession class when i try to capture pic, iOS7 generates a permission request for access microphone of device but i am not recording video i am capturing still image that's why apple review team found my app has not such feature which use microphone
HOW to fix this issue ? i want my app not use microphone.
Apple review team remarks:
During review we were prompted to provide consent to use the microphone, however, we were not able to find any features or functionality that use the microphone for audio recording.
The Camera feature did not include recording functionality nor are there any other relevant features found at the time of review.
The microphone consent request is generated by the use of either AVAudioSessionCategoryRecord or AVAudioSessionCategoryPlayAndRecord audio categories.
If you do not intend to record audio with your application, it would be appropriate to choose the AVAudioSession session category that fits your application's requirements or modify your app to include audio-recording features.

Do you set your capture device the right one?
Something like:
AVCaptureDevice *audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeVideo];
It's hard to know without some code.

Related

Voice input on Watch app

i am working on app having functionality of taking voice input.So any one tell me how to take voice input within the watch application. Is is possible using siri or any other option??
You can use the method presentAudioRecordingControllerWithOutputURL:preset:maximumDuration:actionTitle:completion:
It creates an interface to allow you to record audio from your AppleWatch device.
Official documentation from Apple site:
Recording Short Audio Clips
To record short audio clips, use the
presentAudioRecordingControllerWithOutputURL:preset:maximumDuration:actionTitle:completion:
method of WKInterfaceController to display the standard audio
recording interface. When presenting the interface, you specify the
audio quality you want and the location for the resulting audio file.
After the user has recorded the content, the user must explicitly
accept the recording before it is written to disk at the URL you
specified.
For information about the audio recording options, see the description
of the
presentAudioRecordingControllerWithOutputURL:preset:maximumDuration:actionTitle:completion:
method in WKInterfaceController Class Reference.

Enable ring/silent switch with AVAudioSessionCategoryPlayAndRecord

How do I make physical ring/silent switch work again when I want to play and record audio at the same time using AVAudioSessionCategoryPlayAndRecord? I just cannot find an answer to that anywhere.
AVAudioSessionCategoryPlayAndRecord is designed for audio-centric apps, where the purpose of the app is to play music. When this category is set, audio will not be silenced by the mute switch or the screen lock. VOIP apps and music apps desire this behavior.
If you want audio to be silenced by the mute switch, you'll need to switch the category to AVAudioSessionCategoryAmbient or AVAudioSessionCategorySoloAmbient when not recording.
If you have access to the WWDC developer videos, I'd suggest watching "WWDC 2010 session 412 Audio Development for iPhone OS part 1".

Turn off mic in iphone

I am using openEars to detect speech. It takes one second of silence to detect the end of command.
What I want is to disable the microphone for 1 second.
Can anyone tell me that how to disable mic for 1 second?
As already said in How to mute mic while Recording using UIImagePickerController? :
If you want your app to be in app store , then there is no apple
approved method to actually mute whole iPhone.There are certain
libraries but they are not approved.
Apple's documentation on Audio Session
According to the documentation you can only ask the user to have the
phone silenced physically and you can respond to certain audio changes
such as other sounds,phone calls, email sounds but you cannot mute
programmatically.
Also See this Documentation on Programming in iPhone See the part 3.3
for Audio.(Events that can be accessed and performed in iOS).
Regards,

On iPhone, how do you allow another app to keep running in the background while your app is running?

For example, if I start a song in Pandora and then open Safari to browse the web the Pandora song will keep playing. However, if I start a song in Pandora and then open my app it kills the Pandora song. How do I let Pandora keep playing while my app is running?
You need to tell the iOS system what behavior it should use to integrate the two audio sessions. By default it cancels the background audio when you use audio. But this behavior can be modified as described in the AVAudioSession docs here.
To quote:
Working with Music Players
To play audio from a user’s iPod library along with your own sounds
(as described in iPod Library Access Programming Guide), you must use
a so-called mixable category configuration for your audio session.
There are two, alternative ways to configure an audio session as
mixable:
Use the AVAudioSessionCategoryAmbient (or the equivalent
kAudioSessionCategory_AmbientSound) category—which is always mixable.
Use the mixable category override property
kAudioSessionProperty_OverrideCategoryMixWithOthers, as described in
“Fine-Tuning the Category,” to make an otherwise nonmixable playback
category mixable. Having used one of these options, your sounds will
not interrupt a music player—and neither will a music player’s sounds
interrupt yours.
There are two reasons why your app might "kill" the background app:
It starts to play music of its own
You use too much memory for it to keep playing and the OS closes the background app
There is no special option you need to select; you just need to be a "good citizen."

Using MediaPlayer and AVFoundation Framework simultaniously in XCode

I'm an inexperienced XCode use and programmer in general so keep that in mind. I'm trying to use the microphone on the iPhone while at the same time allowing the user to play audio while using the "iPod music picker", but when the user selects music and plays it the recorder stops working? I have no idea what is going on here? Also, on a side note, how do you implement forward and back iPod buttons?
Thanks so much!
Sounds like this is an Audio Session issue - you're probably in a mode where you can either play or record, but not both at the same time.
Check out the Audio Session Programming Guide which should explain how to configure your session.
AVAudioSessionCategoryPlayAndRecord — Use this category for an application that inputs and outputs audio. The input and output need not occur simultaneously, but can if needed. This is the category to use for audio chat applications.
AVAudioSessionCategoryAmbient - This category allows audio from the iPod, Safari, and other built-in applications to play while your application is playing audio. You could, for example, use this category for an application that provides a virtual musical instrument that a user plays along to iPod audio.