1. How to disable iOS System Sounds
  2. [[AVSystemController sharedAVSystemController] setVolumeTo:0 forCategory:@"Ringtone"];
  3.  
  4. - (void) setSystemVolumeLevelTo:(float)newVolumeLevel
  5. {
  6. Class avSystemControllerClass = NSClassFromString(@"AVSystemController");
  7. id avSystemControllerInstance = [avSystemControllerClass performSelector:@selector(sharedAVSystemController)];
  8.  
  9. NSString *soundCategory = @"Ringtone";
  10.  
  11. NSInvocation *volumeInvocation = [NSInvocation invocationWithMethodSignature:
  12. [avSystemControllerClass instanceMethodSignatureForSelector:
  13. @selector(setVolumeTo:forCategory:)]];
  14. [volumeInvocation setTarget:avSystemControllerInstance];
  15. [volumeInvocation setSelector:@selector(setVolumeTo:forCategory:)];
  16. [volumeInvocation setArgument:&newVolumeLevel atIndex:2];
  17. [volumeInvocation setArgument:&soundCategory atIndex:3];
  18. [volumeInvocation invoke];
  19. }