2

I need to bind own actions on iOS headphones buttons.

For play/pause action i found solution:

  • Add audio background in .xcodeproj
  • Implement method remoteControlReceivedWithEvent
  • Set self as firstResponder

I can't set my class as first responder, bcs my class is subclass of UIViewController. For this method class must be a subclass of UIResponder. So i put this method in AppDelegate and create notifications.

1. Is there other way to put remoteControlReceivedWithEvent in my class, without changing superclass or using notifications?

2. Can i change volume up/down actions?

mastov
  • 2,942
  • 1
  • 16
  • 33
Viktor
  • 1,020
  • 1
  • 9
  • 22

1 Answers1

3

To be honest I think this is a bit of a grey area. Personally I think that if you alter the functions of those buttons your app will get rejected from the Apple iOS App Store Review process for breaching guideline 10.5. However I also don't believe that Apple will test your App with headphones unless you specifically state that headphones are required for your app to work. Though if your app needs headphones to access certain functionality and you didn't tell Apple so they didn't test it and they found out this could possibly get your account banned for dishonesty.

So in all honesty based on the review guidelines I'd say this can't be possible for the reason already stated and I also think that you'd need to access some private APIs to actually achieve this. So would also be rejected under 2.5.

2.5 Apps that use non-public APIs will be rejected

10.5 Apps that alter the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, will be rejected

So if you are going to continue with this I'd tread very carefully about what you (1) do to implement it and (2) what you tell Apple when it goes into the review process. If it was me I'd tell Apple that there is functionality behind those buttons.

However I really don't think this would get past the review process for 2.5 no mind reaching 10.5

Community
  • 1
  • 1
Popeye
  • 11,839
  • 9
  • 58
  • 91
  • remoteControlReceivedEvent is a public API (deprecated, you should use MPRemoteCommandCenter), and people implementing their own audio playback use it (next/previous track, fast forward etc.). However, you don't receive volume control information. – gnasher729 Jul 08 '15 at 10:36
  • @gnasher729 that's fair enough my was more a warning as it is a kind of grey area as you are changing the functionality of standard switches and/or Volume up/down however does this guideline cover headphones? My answer was only meant to provide a warning to tread carefully in how they implement it as Apple may (A big may) take it the wrong way. – Popeye Jul 08 '15 at 10:39
  • @gnasher729 i try MPRemoteCommandCenter but have issue: i set action for command and if don't use it for some time (near 2-3 minutes) it stop to react. In docs [link](https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPRemoteCommandCenter_Ref/#//apple_ref/doc/uid/TP40013864-CH1-SW24) said: Event delivery occurs only while your app is the Now Playing app. As i understand, i need to set not-nill object in MPNowPlayingInfoCenter? – Viktor Jul 08 '15 at 14:10