Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to disable iOS System Sounds
- [[AVSystemController sharedAVSystemController] setVolumeTo:0 forCategory:@"Ringtone"];
- - (void) setSystemVolumeLevelTo:(float)newVolumeLevel
- {
- Class avSystemControllerClass = NSClassFromString(@"AVSystemController");
- id avSystemControllerInstance = [avSystemControllerClass performSelector:@selector(sharedAVSystemController)];
- NSString *soundCategory = @"Ringtone";
- NSInvocation *volumeInvocation = [NSInvocation invocationWithMethodSignature:
- [avSystemControllerClass instanceMethodSignatureForSelector:
- @selector(setVolumeTo:forCategory:)]];
- [volumeInvocation setTarget:avSystemControllerInstance];
- [volumeInvocation setSelector:@selector(setVolumeTo:forCategory:)];
- [volumeInvocation setArgument:&newVolumeLevel atIndex:2];
- [volumeInvocation setArgument:&soundCategory atIndex:3];
- [volumeInvocation invoke];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement