0

Looking for a recommended approach to using the hardware volume buttons on iOS devices to control application functions. In this case, the buttons would be used to increase or decrease a qty field in a warehouse-management application.

There have been similar questions about doing this in Objective-C, but I am specifically inquiring about Swift.

Michael Voccola
  • 1,827
  • 6
  • 20
  • 46
  • possible duplicate of [iOS use the volume buttons as input](http://stackoverflow.com/questions/10458438/ios-use-the-volume-buttons-as-input) – StilesCrisis Dec 09 '14 at 22:25
  • 1
    That question was Objective-C in 2012, I am specifically asking about Swift and do not have any experience with Objective-C – Michael Voccola Dec 09 '14 at 22:27

1 Answers1

2

This cannot be done if you want to release your app on the App Store. It will be rejected; the regulations disallow repurposing the hardware buttons for any other function.

As a specific example, some camera apps have been refused for using volume-up as a camera shutter:

Your application cannot be added to the App Store because it uses iPhone volume buttons in a non-standard way, potentially resulting in user confusion. Changing the behavior of iPhone external hardware buttons is a violation of the iPhone Developer Program License Agreement. Applications must adhere to the iPhone Human Interface Guidelines as outlined in the iPhone Developer Program License Agreement section 3.3.7

http://petapixel.com/2010/08/13/camera-shuttered-from-app-store-for-hidden-banned-feature/

EDIT: since you don't need to work on App Store, I looked for a solution for you and found an older answer you could use. iOS use the volume buttons as input

Community
  • 1
  • 1
StilesCrisis
  • 15,972
  • 4
  • 39
  • 62
  • 2
    While the example was true 4 years ago it got changed like 2 years ago. These days, nearly all camera apps use the volume button(s) to take a photo. New rule is "10.5 Apps that alter the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, will be rejected". And Camera Shutter on Volume became standard. Probably doesn't make a difference in OPs case though – Matthias Bauch Dec 09 '14 at 20:23
  • App store acceptance isn't top priority. This application will be for internal use only. – Michael Voccola Dec 09 '14 at 20:43
  • Camera apps started to use the volume button without rejection because Apple's Camera app actually stole the idea from Camera+, suddenly making the "Volume Up = Shutter" the button's "standard function." The rule itself didn't change. – StilesCrisis Dec 09 '14 at 22:23