├── LICENSE ├── RBDMuteSwitchExample.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── richardhyland.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── richardhyland.xcuserdatad │ └── xcschemes │ ├── RBDMuteSwitchExample.xcscheme │ └── xcschememanagement.plist ├── RBDMuteSwitchExample ├── RBDAppDelegate.h ├── RBDAppDelegate.m ├── RBDMuteSwitch.h ├── RBDMuteSwitch.m ├── RBDMuteSwitchExample-Info.plist ├── RBDMuteSwitchExample-Prefix.pch ├── RBDViewController.h ├── RBDViewController.m ├── detection.aiff ├── en.lproj │ ├── InfoPlist.strings │ ├── RBDViewController_iPad.xib │ └── RBDViewController_iPhone.xib └── main.m └── Readme.txt /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Richard Hyland http://www.richardhyland.com 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 1. Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | 2. Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | 3. All advertising materials mentioning features or use of this software 12 | must display the following acknowledgement: 13 | This product includes software developed by the Richard Hyland. 14 | 4. Neither the name of the Richard Hyland nor the 15 | names of its contributors may be used to endorse or promote products 16 | derived from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY ''AS IS'' AND ANY 19 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /RBDMuteSwitchExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8E709D34153EF20100FA6EED /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E709D33153EF20100FA6EED /* UIKit.framework */; }; 11 | 8E709D36153EF20100FA6EED /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E709D35153EF20100FA6EED /* Foundation.framework */; }; 12 | 8E709D38153EF20100FA6EED /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E709D37153EF20100FA6EED /* CoreGraphics.framework */; }; 13 | 8E709D3E153EF20100FA6EED /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8E709D3C153EF20100FA6EED /* InfoPlist.strings */; }; 14 | 8E709D40153EF20100FA6EED /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E709D3F153EF20100FA6EED /* main.m */; }; 15 | 8E709D44153EF20100FA6EED /* RBDAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E709D43153EF20100FA6EED /* RBDAppDelegate.m */; }; 16 | 8E709D47153EF20100FA6EED /* RBDViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E709D46153EF20100FA6EED /* RBDViewController.m */; }; 17 | 8E709D4A153EF20100FA6EED /* RBDViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8E709D48153EF20100FA6EED /* RBDViewController_iPhone.xib */; }; 18 | 8E709D4D153EF20100FA6EED /* RBDViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8E709D4B153EF20100FA6EED /* RBDViewController_iPad.xib */; }; 19 | 8E709D57153EF28E00FA6EED /* RBDMuteSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E709D56153EF28E00FA6EED /* RBDMuteSwitch.m */; }; 20 | 8E709D59153EF2DE00FA6EED /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E709D58153EF2DE00FA6EED /* AudioToolbox.framework */; }; 21 | 8E709D5B153EF40E00FA6EED /* detection.aiff in Resources */ = {isa = PBXBuildFile; fileRef = 8E709D5A153EF40E00FA6EED /* detection.aiff */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 8E709D2F153EF20100FA6EED /* RBDMuteSwitchExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RBDMuteSwitchExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | 8E709D33153EF20100FA6EED /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 27 | 8E709D35153EF20100FA6EED /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 28 | 8E709D37153EF20100FA6EED /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 29 | 8E709D3B153EF20100FA6EED /* RBDMuteSwitchExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "RBDMuteSwitchExample-Info.plist"; sourceTree = ""; }; 30 | 8E709D3D153EF20100FA6EED /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 31 | 8E709D3F153EF20100FA6EED /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32 | 8E709D41153EF20100FA6EED /* RBDMuteSwitchExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RBDMuteSwitchExample-Prefix.pch"; sourceTree = ""; }; 33 | 8E709D42153EF20100FA6EED /* RBDAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RBDAppDelegate.h; sourceTree = ""; }; 34 | 8E709D43153EF20100FA6EED /* RBDAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RBDAppDelegate.m; sourceTree = ""; }; 35 | 8E709D45153EF20100FA6EED /* RBDViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RBDViewController.h; sourceTree = ""; }; 36 | 8E709D46153EF20100FA6EED /* RBDViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RBDViewController.m; sourceTree = ""; }; 37 | 8E709D49153EF20100FA6EED /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/RBDViewController_iPhone.xib; sourceTree = ""; }; 38 | 8E709D4C153EF20100FA6EED /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/RBDViewController_iPad.xib; sourceTree = ""; }; 39 | 8E709D55153EF28E00FA6EED /* RBDMuteSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RBDMuteSwitch.h; sourceTree = ""; }; 40 | 8E709D56153EF28E00FA6EED /* RBDMuteSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RBDMuteSwitch.m; sourceTree = ""; }; 41 | 8E709D58153EF2DE00FA6EED /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 42 | 8E709D5A153EF40E00FA6EED /* detection.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; path = detection.aiff; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 8E709D2C153EF20100FA6EED /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | 8E709D59153EF2DE00FA6EED /* AudioToolbox.framework in Frameworks */, 51 | 8E709D34153EF20100FA6EED /* UIKit.framework in Frameworks */, 52 | 8E709D36153EF20100FA6EED /* Foundation.framework in Frameworks */, 53 | 8E709D38153EF20100FA6EED /* CoreGraphics.framework in Frameworks */, 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | 8E709D24153EF20000FA6EED = { 61 | isa = PBXGroup; 62 | children = ( 63 | 8E709D39153EF20100FA6EED /* RBDMuteSwitchExample */, 64 | 8E709D32153EF20100FA6EED /* Frameworks */, 65 | 8E709D30153EF20100FA6EED /* Products */, 66 | ); 67 | sourceTree = ""; 68 | }; 69 | 8E709D30153EF20100FA6EED /* Products */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 8E709D2F153EF20100FA6EED /* RBDMuteSwitchExample.app */, 73 | ); 74 | name = Products; 75 | sourceTree = ""; 76 | }; 77 | 8E709D32153EF20100FA6EED /* Frameworks */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 8E709D58153EF2DE00FA6EED /* AudioToolbox.framework */, 81 | 8E709D33153EF20100FA6EED /* UIKit.framework */, 82 | 8E709D35153EF20100FA6EED /* Foundation.framework */, 83 | 8E709D37153EF20100FA6EED /* CoreGraphics.framework */, 84 | ); 85 | name = Frameworks; 86 | sourceTree = ""; 87 | }; 88 | 8E709D39153EF20100FA6EED /* RBDMuteSwitchExample */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 8E709D42153EF20100FA6EED /* RBDAppDelegate.h */, 92 | 8E709D43153EF20100FA6EED /* RBDAppDelegate.m */, 93 | 8E709D45153EF20100FA6EED /* RBDViewController.h */, 94 | 8E709D46153EF20100FA6EED /* RBDViewController.m */, 95 | 8E709D48153EF20100FA6EED /* RBDViewController_iPhone.xib */, 96 | 8E709D4B153EF20100FA6EED /* RBDViewController_iPad.xib */, 97 | 8E709D3A153EF20100FA6EED /* Supporting Files */, 98 | 8E709D55153EF28E00FA6EED /* RBDMuteSwitch.h */, 99 | 8E709D56153EF28E00FA6EED /* RBDMuteSwitch.m */, 100 | ); 101 | path = RBDMuteSwitchExample; 102 | sourceTree = ""; 103 | }; 104 | 8E709D3A153EF20100FA6EED /* Supporting Files */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 8E709D5A153EF40E00FA6EED /* detection.aiff */, 108 | 8E709D3B153EF20100FA6EED /* RBDMuteSwitchExample-Info.plist */, 109 | 8E709D3C153EF20100FA6EED /* InfoPlist.strings */, 110 | 8E709D3F153EF20100FA6EED /* main.m */, 111 | 8E709D41153EF20100FA6EED /* RBDMuteSwitchExample-Prefix.pch */, 112 | ); 113 | name = "Supporting Files"; 114 | sourceTree = ""; 115 | }; 116 | /* End PBXGroup section */ 117 | 118 | /* Begin PBXNativeTarget section */ 119 | 8E709D2E153EF20100FA6EED /* RBDMuteSwitchExample */ = { 120 | isa = PBXNativeTarget; 121 | buildConfigurationList = 8E709D50153EF20100FA6EED /* Build configuration list for PBXNativeTarget "RBDMuteSwitchExample" */; 122 | buildPhases = ( 123 | 8E709D2B153EF20100FA6EED /* Sources */, 124 | 8E709D2C153EF20100FA6EED /* Frameworks */, 125 | 8E709D2D153EF20100FA6EED /* Resources */, 126 | ); 127 | buildRules = ( 128 | ); 129 | dependencies = ( 130 | ); 131 | name = RBDMuteSwitchExample; 132 | productName = RBDMuteSwitchExample; 133 | productReference = 8E709D2F153EF20100FA6EED /* RBDMuteSwitchExample.app */; 134 | productType = "com.apple.product-type.application"; 135 | }; 136 | /* End PBXNativeTarget section */ 137 | 138 | /* Begin PBXProject section */ 139 | 8E709D26153EF20000FA6EED /* Project object */ = { 140 | isa = PBXProject; 141 | attributes = { 142 | CLASSPREFIX = RBD; 143 | LastUpgradeCheck = 0430; 144 | }; 145 | buildConfigurationList = 8E709D29153EF20000FA6EED /* Build configuration list for PBXProject "RBDMuteSwitchExample" */; 146 | compatibilityVersion = "Xcode 3.2"; 147 | developmentRegion = English; 148 | hasScannedForEncodings = 0; 149 | knownRegions = ( 150 | en, 151 | ); 152 | mainGroup = 8E709D24153EF20000FA6EED; 153 | productRefGroup = 8E709D30153EF20100FA6EED /* Products */; 154 | projectDirPath = ""; 155 | projectRoot = ""; 156 | targets = ( 157 | 8E709D2E153EF20100FA6EED /* RBDMuteSwitchExample */, 158 | ); 159 | }; 160 | /* End PBXProject section */ 161 | 162 | /* Begin PBXResourcesBuildPhase section */ 163 | 8E709D2D153EF20100FA6EED /* Resources */ = { 164 | isa = PBXResourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | 8E709D3E153EF20100FA6EED /* InfoPlist.strings in Resources */, 168 | 8E709D4A153EF20100FA6EED /* RBDViewController_iPhone.xib in Resources */, 169 | 8E709D4D153EF20100FA6EED /* RBDViewController_iPad.xib in Resources */, 170 | 8E709D5B153EF40E00FA6EED /* detection.aiff in Resources */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXResourcesBuildPhase section */ 175 | 176 | /* Begin PBXSourcesBuildPhase section */ 177 | 8E709D2B153EF20100FA6EED /* Sources */ = { 178 | isa = PBXSourcesBuildPhase; 179 | buildActionMask = 2147483647; 180 | files = ( 181 | 8E709D40153EF20100FA6EED /* main.m in Sources */, 182 | 8E709D44153EF20100FA6EED /* RBDAppDelegate.m in Sources */, 183 | 8E709D47153EF20100FA6EED /* RBDViewController.m in Sources */, 184 | 8E709D57153EF28E00FA6EED /* RBDMuteSwitch.m in Sources */, 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | }; 188 | /* End PBXSourcesBuildPhase section */ 189 | 190 | /* Begin PBXVariantGroup section */ 191 | 8E709D3C153EF20100FA6EED /* InfoPlist.strings */ = { 192 | isa = PBXVariantGroup; 193 | children = ( 194 | 8E709D3D153EF20100FA6EED /* en */, 195 | ); 196 | name = InfoPlist.strings; 197 | sourceTree = ""; 198 | }; 199 | 8E709D48153EF20100FA6EED /* RBDViewController_iPhone.xib */ = { 200 | isa = PBXVariantGroup; 201 | children = ( 202 | 8E709D49153EF20100FA6EED /* en */, 203 | ); 204 | name = RBDViewController_iPhone.xib; 205 | sourceTree = ""; 206 | }; 207 | 8E709D4B153EF20100FA6EED /* RBDViewController_iPad.xib */ = { 208 | isa = PBXVariantGroup; 209 | children = ( 210 | 8E709D4C153EF20100FA6EED /* en */, 211 | ); 212 | name = RBDViewController_iPad.xib; 213 | sourceTree = ""; 214 | }; 215 | /* End PBXVariantGroup section */ 216 | 217 | /* Begin XCBuildConfiguration section */ 218 | 8E709D4E153EF20100FA6EED /* Debug */ = { 219 | isa = XCBuildConfiguration; 220 | buildSettings = { 221 | ALWAYS_SEARCH_USER_PATHS = NO; 222 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 223 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 224 | COPY_PHASE_STRIP = NO; 225 | GCC_C_LANGUAGE_STANDARD = gnu99; 226 | GCC_DYNAMIC_NO_PIC = NO; 227 | GCC_OPTIMIZATION_LEVEL = 0; 228 | GCC_PREPROCESSOR_DEFINITIONS = ( 229 | "DEBUG=1", 230 | "$(inherited)", 231 | ); 232 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 233 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 235 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 236 | GCC_WARN_UNUSED_VARIABLE = YES; 237 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 238 | SDKROOT = iphoneos; 239 | TARGETED_DEVICE_FAMILY = "1,2"; 240 | }; 241 | name = Debug; 242 | }; 243 | 8E709D4F153EF20100FA6EED /* Release */ = { 244 | isa = XCBuildConfiguration; 245 | buildSettings = { 246 | ALWAYS_SEARCH_USER_PATHS = NO; 247 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 248 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 249 | COPY_PHASE_STRIP = YES; 250 | GCC_C_LANGUAGE_STANDARD = gnu99; 251 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 252 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 253 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 254 | GCC_WARN_UNUSED_VARIABLE = YES; 255 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 256 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 257 | SDKROOT = iphoneos; 258 | TARGETED_DEVICE_FAMILY = "1,2"; 259 | VALIDATE_PRODUCT = YES; 260 | }; 261 | name = Release; 262 | }; 263 | 8E709D51153EF20100FA6EED /* Debug */ = { 264 | isa = XCBuildConfiguration; 265 | buildSettings = { 266 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 267 | GCC_PREFIX_HEADER = "RBDMuteSwitchExample/RBDMuteSwitchExample-Prefix.pch"; 268 | INFOPLIST_FILE = "RBDMuteSwitchExample/RBDMuteSwitchExample-Info.plist"; 269 | PRODUCT_NAME = "$(TARGET_NAME)"; 270 | WRAPPER_EXTENSION = app; 271 | }; 272 | name = Debug; 273 | }; 274 | 8E709D52153EF20100FA6EED /* Release */ = { 275 | isa = XCBuildConfiguration; 276 | buildSettings = { 277 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 278 | GCC_PREFIX_HEADER = "RBDMuteSwitchExample/RBDMuteSwitchExample-Prefix.pch"; 279 | INFOPLIST_FILE = "RBDMuteSwitchExample/RBDMuteSwitchExample-Info.plist"; 280 | PRODUCT_NAME = "$(TARGET_NAME)"; 281 | WRAPPER_EXTENSION = app; 282 | }; 283 | name = Release; 284 | }; 285 | /* End XCBuildConfiguration section */ 286 | 287 | /* Begin XCConfigurationList section */ 288 | 8E709D29153EF20000FA6EED /* Build configuration list for PBXProject "RBDMuteSwitchExample" */ = { 289 | isa = XCConfigurationList; 290 | buildConfigurations = ( 291 | 8E709D4E153EF20100FA6EED /* Debug */, 292 | 8E709D4F153EF20100FA6EED /* Release */, 293 | ); 294 | defaultConfigurationIsVisible = 0; 295 | defaultConfigurationName = Release; 296 | }; 297 | 8E709D50153EF20100FA6EED /* Build configuration list for PBXNativeTarget "RBDMuteSwitchExample" */ = { 298 | isa = XCConfigurationList; 299 | buildConfigurations = ( 300 | 8E709D51153EF20100FA6EED /* Debug */, 301 | 8E709D52153EF20100FA6EED /* Release */, 302 | ); 303 | defaultConfigurationIsVisible = 0; 304 | defaultConfigurationName = Release; 305 | }; 306 | /* End XCConfigurationList section */ 307 | }; 308 | rootObject = 8E709D26153EF20000FA6EED /* Project object */; 309 | } 310 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample.xcodeproj/project.xcworkspace/xcuserdata/richardhyland.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rich2k/RBDMuteSwitch/2f68044bbde484c35f0c5251e01b0229343c18df/RBDMuteSwitchExample.xcodeproj/project.xcworkspace/xcuserdata/richardhyland.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RBDMuteSwitchExample.xcodeproj/xcuserdata/richardhyland.xcuserdatad/xcschemes/RBDMuteSwitchExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 50 | 51 | 57 | 58 | 59 | 60 | 61 | 62 | 68 | 69 | 75 | 76 | 77 | 78 | 80 | 81 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample.xcodeproj/xcuserdata/richardhyland.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RBDMuteSwitchExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8E709D2E153EF20100FA6EED 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/RBDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // RBDAppDelegate.h 3 | // RBDMuteSwitchExample 4 | // 5 | // Created by Richard Hyland on 18/04/2012. 6 | // Copyright (c) 2012 RBDSolutions Limited. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RBDViewController; 12 | 13 | @interface RBDAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) RBDViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/RBDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // RBDAppDelegate.m 3 | // RBDMuteSwitchExample 4 | // 5 | // Created by Richard Hyland on 18/04/2012. 6 | // Copyright (c) 2012 RBDSolutions Limited. All rights reserved. 7 | // 8 | 9 | #import "RBDAppDelegate.h" 10 | 11 | #import "RBDViewController.h" 12 | 13 | @implementation RBDAppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize viewController = _viewController; 17 | 18 | - (void)dealloc 19 | { 20 | [_window release]; 21 | [_viewController release]; 22 | [super dealloc]; 23 | } 24 | 25 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 26 | { 27 | self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 28 | // Override point for customization after application launch. 29 | if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { 30 | self.viewController = [[[RBDViewController alloc] initWithNibName:@"RBDViewController_iPhone" bundle:nil] autorelease]; 31 | } else { 32 | self.viewController = [[[RBDViewController alloc] initWithNibName:@"RBDViewController_iPad" bundle:nil] autorelease]; 33 | } 34 | self.window.rootViewController = self.viewController; 35 | [self.window makeKeyAndVisible]; 36 | return YES; 37 | } 38 | 39 | - (void)applicationWillResignActive:(UIApplication *)application 40 | { 41 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 42 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 43 | } 44 | 45 | - (void)applicationDidEnterBackground:(UIApplication *)application 46 | { 47 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 48 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 49 | } 50 | 51 | - (void)applicationWillEnterForeground:(UIApplication *)application 52 | { 53 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 54 | } 55 | 56 | - (void)applicationDidBecomeActive:(UIApplication *)application 57 | { 58 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 59 | } 60 | 61 | - (void)applicationWillTerminate:(UIApplication *)application 62 | { 63 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/RBDMuteSwitch.h: -------------------------------------------------------------------------------- 1 | // 2 | // RBDMuteSwitch.h 3 | // RBDMuteSwitchExample 4 | // 5 | // Created by Richard Hyland on 18/04/2012. 6 | // Copyright (c) 2012 RBDSolutions Limited. All rights reserved. 7 | // 8 | 9 | /** This class detects whether the device is muted including under iOS 5. 10 | You should use the sharedInstance to get an instance and implement the isMuted: delegate method. 11 | 12 | Example 13 | [[RBDMuteSwitch sharedInstance] setDelegate:self]; 14 | [[RBDMuteSwitch sharedInstance] detectMuteSwitch]; 15 | 16 | - (void)isMuted:(BOOL)muted { 17 | } 18 | */ 19 | 20 | #import 21 | #include 22 | 23 | @class RBDMuteSwitch; 24 | 25 | @protocol RBDMuteSwitchDelegate 26 | @required 27 | - (void)isMuted:(BOOL)muted; 28 | @end 29 | 30 | @interface RBDMuteSwitch : NSObject { 31 | @private 32 | NSObject *delegate; 33 | float soundDuration; 34 | NSTimer *playbackTimer; 35 | } 36 | 37 | /** 38 | Your delegate 39 | */ 40 | @property (readwrite, retain) NSObject *delegate; 41 | 42 | /** Creates a shared instance 43 | */ 44 | + (RBDMuteSwitch *)sharedInstance; 45 | 46 | /** Determines if the device is muted, wait for delegate callback using isMuted: on your delegate. 47 | */ 48 | - (void)detectMuteSwitch; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/RBDMuteSwitch.m: -------------------------------------------------------------------------------- 1 | // 2 | // RBDMuteSwitch.m 3 | // RBDMuteSwitchExample 4 | // 5 | // Created by Richard Hyland on 18/04/2012. 6 | // Copyright (c) 2012 RBDSolutions Limited. All rights reserved. 7 | // 8 | 9 | #import "RBDMuteSwitch.h" 10 | 11 | static RBDMuteSwitch *_sharedInstance; 12 | 13 | @implementation RBDMuteSwitch 14 | 15 | @synthesize delegate; 16 | 17 | + (RBDMuteSwitch *)sharedInstance 18 | { 19 | if (!_sharedInstance) { 20 | _sharedInstance = [[[self class] alloc] init]; 21 | } 22 | return _sharedInstance; 23 | } 24 | 25 | - (id)init 26 | { 27 | self = [super init]; 28 | if (self) { 29 | } 30 | 31 | return self; 32 | } 33 | 34 | - (void)dealloc { 35 | [delegate release]; 36 | [super dealloc]; 37 | } 38 | 39 | - (void)playbackComplete { 40 | if ([(id)self.delegate respondsToSelector:@selector(isMuted:)]) { 41 | // If playback is far less than 100ms then we know the device is muted 42 | if (soundDuration < 0.010) { 43 | [delegate isMuted:YES]; 44 | } 45 | else { 46 | [delegate isMuted:NO]; 47 | } 48 | } 49 | [playbackTimer invalidate]; 50 | playbackTimer = nil; 51 | 52 | 53 | } 54 | 55 | static void soundCompletionCallback (SystemSoundID mySSID, void* myself) { 56 | AudioServicesRemoveSystemSoundCompletion (mySSID); 57 | [[RBDMuteSwitch sharedInstance] playbackComplete]; 58 | } 59 | 60 | - (void)incrementTimer { 61 | soundDuration = soundDuration + 0.001; 62 | } 63 | 64 | - (void)detectMuteSwitch { 65 | #if TARGET_IPHONE_SIMULATOR 66 | // The simulator doesn't support detection and can cause a crash so always return muted 67 | if ([(id)self.delegate respondsToSelector:@selector(isMuted:)]) { 68 | [self.delegate isMuted:YES]; 69 | } 70 | return; 71 | #endif 72 | 73 | #if __IPHONE_5_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED 74 | // iOS 5+ doesn't allow mute switch detection using state length detection 75 | // So we need to play a blank 100ms file and detect the playback length 76 | soundDuration = 0.0; 77 | CFURLRef soundFileURLRef; 78 | SystemSoundID soundFileObject; 79 | 80 | // Get the main bundle for the app 81 | CFBundleRef mainBundle; 82 | mainBundle = CFBundleGetMainBundle(); 83 | 84 | // Get the URL to the sound file to play 85 | soundFileURLRef = CFBundleCopyResourceURL( 86 | mainBundle, 87 | CFSTR ("detection"), 88 | CFSTR ("aiff"), 89 | NULL 90 | ); 91 | 92 | // Create a system sound object representing the sound file 93 | AudioServicesCreateSystemSoundID ( 94 | soundFileURLRef, 95 | &soundFileObject 96 | ); 97 | 98 | AudioServicesAddSystemSoundCompletion (soundFileObject,NULL,NULL, 99 | soundCompletionCallback, 100 | (void*) self); 101 | 102 | // Start the playback timer 103 | playbackTimer = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(incrementTimer) userInfo:nil repeats:YES]; 104 | // Play the sound 105 | AudioServicesPlaySystemSound(soundFileObject); 106 | return; 107 | #else 108 | // This method doesn't work under iOS 5+ 109 | CFStringRef state; 110 | UInt32 propertySize = sizeof(CFStringRef); 111 | AudioSessionInitialize(NULL, NULL, NULL, NULL); 112 | AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state); 113 | if(CFStringGetLength(state) > 0) { 114 | if ([(id)self.delegate respondsToSelector:@selector(isMuted:)]) { 115 | [self.delegate isMuted:NO]; 116 | } 117 | } 118 | if ([(id)self.delegate respondsToSelector:@selector(isMuted:)]) { 119 | [self.delegate isMuted:YES]; 120 | } 121 | return; 122 | #endif 123 | } 124 | 125 | @end 126 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/RBDMuteSwitchExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.rbdsolutions.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/RBDMuteSwitchExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'RBDMuteSwitchExample' target in the 'RBDMuteSwitchExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/RBDViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RBDViewController.h 3 | // RBDMuteSwitchExample 4 | // 5 | // Created by Richard Hyland on 18/04/2012. 6 | // Copyright (c) 2012 RBDSolutions Limited. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "RBDMuteSwitch.h" 11 | 12 | @interface RBDViewController : UIViewController { 13 | NSTimer* updateTimer; 14 | } 15 | 16 | @property (nonatomic, retain) IBOutlet UILabel *muteLabel; 17 | 18 | - (void)beginDetection; 19 | @end 20 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/RBDViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RBDViewController.m 3 | // RBDMuteSwitchExample 4 | // 5 | // Created by Richard Hyland on 18/04/2012. 6 | // Copyright (c) 2012 RBDSolutions Limited. All rights reserved. 7 | // 8 | 9 | #import "RBDViewController.h" 10 | 11 | @implementation RBDViewController 12 | 13 | @synthesize muteLabel; 14 | 15 | #pragma mark View Lifecycle methods 16 | - (void)viewDidLoad 17 | { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)viewDidUnload 23 | { 24 | [super viewDidUnload]; 25 | // Release any retained subviews of the main view. 26 | } 27 | 28 | - (void)viewDidAppear:(BOOL)animated { 29 | [super viewDidAppear:animated]; 30 | [self beginDetection]; 31 | updateTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(beginDetection) userInfo:nil repeats:YES]; 32 | } 33 | 34 | - (void)viewWillDisappear:(BOOL)animated { 35 | [super viewWillDisappear:animated]; 36 | [updateTimer invalidate]; 37 | updateTimer = nil; 38 | 39 | [[RBDMuteSwitch sharedInstance] setDelegate:nil]; 40 | } 41 | 42 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 43 | { 44 | if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { 45 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 46 | } else { 47 | return YES; 48 | } 49 | } 50 | 51 | #pragma mark Timer methods 52 | - (void)beginDetection { 53 | [[RBDMuteSwitch sharedInstance] setDelegate:self]; 54 | [[RBDMuteSwitch sharedInstance] detectMuteSwitch]; 55 | } 56 | 57 | 58 | #pragma mark RBDMuteSwitchDelegate methods 59 | - (void)isMuted:(BOOL)muted { 60 | if (muted) { 61 | [muteLabel setText:@"Muted"]; 62 | } 63 | else { 64 | [muteLabel setText:@"Not Muted"]; 65 | } 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/detection.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rich2k/RBDMuteSwitch/2f68044bbde484c35f0c5251e01b0229343c18df/RBDMuteSwitchExample/detection.aiff -------------------------------------------------------------------------------- /RBDMuteSwitchExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/en.lproj/RBDViewController_iPad.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1296 5 | 11D50 6 | 2182 7 | 1138.32 8 | 568.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1181 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | IBUILabel 17 | 18 | 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | PluginDependencyRecalculationVersion 23 | 24 | 25 | 26 | 27 | IBFilesOwner 28 | IBIPadFramework 29 | 30 | 31 | IBFirstResponder 32 | IBIPadFramework 33 | 34 | 35 | 36 | 274 37 | 38 | 39 | 40 | 292 41 | {{203, 227}, {346, 21}} 42 | 43 | 44 | 45 | _NS:9 46 | NO 47 | YES 48 | 7 49 | NO 50 | IBIPadFramework 51 | Muted 52 | 53 | 1 54 | MCAwIDAAA 55 | 56 | 57 | 0 58 | 10 59 | 1 60 | 61 | 1 62 | 17 63 | 64 | 65 | Helvetica 66 | 17 67 | 16 68 | 69 | 70 | 71 | {{0, 20}, {768, 1004}} 72 | 73 | 74 | 75 | 76 | 3 77 | MQA 78 | 79 | 2 80 | 81 | 82 | 83 | 2 84 | 85 | IBIPadFramework 86 | 87 | 88 | 89 | 90 | 91 | 92 | view 93 | 94 | 95 | 96 | 3 97 | 98 | 99 | 100 | muteLabel 101 | 102 | 103 | 104 | 5 105 | 106 | 107 | 108 | 109 | 110 | 0 111 | 112 | 113 | 114 | 115 | 116 | -1 117 | 118 | 119 | File's Owner 120 | 121 | 122 | -2 123 | 124 | 125 | 126 | 127 | 2 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 4 136 | 137 | 138 | 139 | 140 | 141 | 142 | RBDViewController 143 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 144 | UIResponder 145 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 146 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 147 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 148 | 149 | 150 | 151 | 152 | 153 | 5 154 | 155 | 156 | 157 | 158 | RBDViewController 159 | UIViewController 160 | 161 | muteLabel 162 | UILabel 163 | 164 | 165 | muteLabel 166 | 167 | muteLabel 168 | UILabel 169 | 170 | 171 | 172 | IBProjectSource 173 | ./Classes/RBDViewController.h 174 | 175 | 176 | 177 | 178 | 0 179 | IBIPadFramework 180 | 181 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 182 | 183 | 184 | YES 185 | 3 186 | 1181 187 | 188 | 189 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/en.lproj/RBDViewController_iPhone.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1296 5 | 11D50 6 | 2182 7 | 1138.32 8 | 568.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1181 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | IBUILabel 17 | 18 | 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | PluginDependencyRecalculationVersion 23 | 24 | 25 | 26 | 27 | IBFilesOwner 28 | IBCocoaTouchFramework 29 | 30 | 31 | IBFirstResponder 32 | IBCocoaTouchFramework 33 | 34 | 35 | 36 | 274 37 | 38 | 39 | 40 | 292 41 | {{86, 210}, {157, 21}} 42 | 43 | 44 | 45 | _NS:9 46 | NO 47 | YES 48 | 7 49 | NO 50 | IBCocoaTouchFramework 51 | Muted 52 | 53 | 1 54 | MCAwIDAAA 55 | 56 | 57 | 0 58 | 10 59 | 1 60 | 61 | 1 62 | 17 63 | 64 | 65 | Helvetica 66 | 17 67 | 16 68 | 69 | 70 | 71 | {{0, 20}, {320, 460}} 72 | 73 | 74 | 75 | 76 | 3 77 | MC43NQA 78 | 79 | 2 80 | 81 | 82 | NO 83 | 84 | IBCocoaTouchFramework 85 | 86 | 87 | 88 | 89 | 90 | 91 | view 92 | 93 | 94 | 95 | 7 96 | 97 | 98 | 99 | muteLabel 100 | 101 | 102 | 103 | 9 104 | 105 | 106 | 107 | 108 | 109 | 0 110 | 111 | 112 | 113 | 114 | 115 | -1 116 | 117 | 118 | File's Owner 119 | 120 | 121 | -2 122 | 123 | 124 | 125 | 126 | 6 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 8 135 | 136 | 137 | 138 | 139 | 140 | 141 | RBDViewController 142 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 143 | UIResponder 144 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 145 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 146 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 147 | 148 | 149 | 150 | 151 | 152 | 9 153 | 154 | 155 | 156 | 157 | RBDViewController 158 | UIViewController 159 | 160 | muteLabel 161 | UILabel 162 | 163 | 164 | muteLabel 165 | 166 | muteLabel 167 | UILabel 168 | 169 | 170 | 171 | IBProjectSource 172 | ./Classes/RBDViewController.h 173 | 174 | 175 | 176 | 177 | 0 178 | IBCocoaTouchFramework 179 | 180 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 181 | 182 | 183 | YES 184 | 3 185 | 1181 186 | 187 | 188 | -------------------------------------------------------------------------------- /RBDMuteSwitchExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RBDMuteSwitchExample 4 | // 5 | // Created by Richard Hyland on 18/04/2012. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "RBDAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([RBDAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Readme.txt: -------------------------------------------------------------------------------- 1 | Prior to iOS 5 it was relatively straightforward to detect whether a device was muted by using an audio route to detect playback type. 2 | 3 | However under iOS 5 this was changed as Apple never intended for this behaviour. In fact Apple have stated that there is no way to obtain the positioning of the mute switch and have stated that this is not a bug but an intentional change. 4 | 5 | However RBDMuteSwitch is a simple, small and easy to use component that takes minutes to integrate, and will even work under previous versions of iOS. 6 | 7 | A sample project is included 8 | 9 | To integrate: 10 | 11 | Include RBDMuteSwitch.h, RBDMuteSwitch.m and detection.aiff to your app 12 | 13 | Add the following to the header file where you wish to detect the mute switch 14 | 15 | #import "RBDMuteSwitch.h" 16 | 17 | to your interface declaration add the RBDMuteSwitchDelegate 18 | 19 | @interface MainViewController : UIViewController 20 | 21 | To your implementation you can call the detection routine 22 | 23 | [[RBDMuteSwitch sharedInstance] setDelegate:self]; 24 | [[RBDMuteSwitch sharedInstance] detectMuteSwitch]; 25 | 26 | then add the isMuted: delegate method 27 | 28 | - (void)isMuted:(BOOL)muted { 29 | if (muted) { 30 | NSLog("Muted"); 31 | } 32 | else { 33 | NSLog("Not Muted"); 34 | } 35 | } --------------------------------------------------------------------------------