uilocalnotification problem
I am working with uilocalnotifications.I have a problem with it.When i run it on simulator it is making sound.but when i run on device it is not making any sound.开发者_运维百科Tell me why?.Thanks in advance
The first issue might be the audio encoding. The simulator can play audio for local notifications that the hardware cannot. Make sure it is one of the encodings and formats the hardware can handle. For example, the following command line converts an input sound into something that can be played by a UILocalNotification:
afconvert -f caff -d LEI16@11025 inputfile.wav outputfile.caf
-f caff Specifies the file as Core Audio File Format
-d LEI16@11025 Specifies the data encoded as 16 bit, little endian linear PCM at a sampling rate of 11025
Take a look at Preparing Custom Alert Sounds for more information and options.
A second issue might be the length. According to the docs, the sounds must be 30 seconds or less in length. In practice, I’ve found it’s more like 20-25 seconds. A sound longer than that might play in the simulator but not on the device.
精彩评论