In iOS 6 I used this line:
NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.UIKit"] pathForResource:@"Tock" ofType:@"aiff"];
to get the path to the system tock sound. Everything was alright. Now since iOS 7, (null) is returned as the path.
Can anyone tell me what happened to the tock sound?
I already tried relinking the UIKit.framework library and got the same result. I just can´t find the reason why this line changed it´s result.
Thanks for your help!
Doing a quick research in the resources for the SDK, it's not there anymore.
[dbarden@Daniels-MacBook-Pro-3/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs]
[16:24:03]% find . -name Tock.aiff
./iPhoneSimulator5.1.sdk/System/Library/Frameworks/UIKit.framework/Tock.aiff
./iPhoneSimulator6.0.sdk/System/Library/Frameworks/UIKit.framework/Tock.aiff
./iPhoneSimulator6.1.sdk/System/Library/Frameworks/UIKit.framework/Tock.aiff
List of all available system sounds in iOS: iOSSystemSoundsLibrary.
You can test all sounds with this small demo app
This post is top on Google about the topic, so I'll add an alternative answer that took me way too much time to find.
The file is no longer included in the com.apple.UIKit bundle because it's not intended to be used directly anymore. Since iOS 4.2, the intended method to play this sound is
[[UIDevice currentDevice] playInputClick];
Hopefully, this prevents anyone else from wasting time trying to find an alternative solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With