Monday, May 25, 2009

A Weird Exception from iPhone Simulator

Today I met a weird exception from AUGraphStart().

Basically, I was running an old sample code written by myself. The main function is mix 2 audio files a playback them simultaneously. I worked fine before, but when I run it, I got this exception:

[00:23:58.425 <AURemoteIOServer>] AQMEIOBase::DoStartIO: timeout
[00:23:58.701 <AURemoteIOServer>] AQMEDevice::StartIO: AudioOutputUnitStart returned -66681
[00:23:58.701 <0xa084a720>] AUIOClient_StartIO failed (-66681)
AUGraphStart FFFEFB87

Obviously, it wasn't came from my code, and I have no idea on this exception now. Did anybody get a same exception recently?

I had tried these:

   1. Restart the XCode. -- No effects.

   2. Restart the machine(Mac Pro, 10.5.7), and restart the XCode. -- No effects.

   3. Reinstall the most recent SDK(Build 9M2735), restart the XCode. -- No effects.

   4. Set the base SDK to 2.2.1 and target to Simulator 2.2.1 Debug. -- No effects.

It's really odd!

Please, if anybody had met similar exception and got a solution, help me out!

Still don’t know how to resolve it now. I need  help!

[Update 2009-06-11]

A week ago, Apple’s engineer had confirmed that they had a bug in UIKit framework.

We do have a simple workaround for this UIKit bug. In change this:

  UIKIT_EXTERN @interface UILocalizedIndexedCollation : NSObject


  UIKIT_EXTERN_CLASS @interface UILocalizedIndexedCollation : NSObject

Having done that, we can build your project and confirm that AUGraphStart returns 0 in the 3.0 simulator.


But, after I installed the 3.0 GM Version today, it’s still not included in the GM Version. So that means I still can not play audio in the simulator. I can ONLY do it on the device!


  1. Don't know why this works, but it did (for me):

    Make sure the iphone simulator is closed. Then go to System Preferences ==> Sound ==> Sound Effects and then turn off and on "Play user interface sound effects".

  2. Adrew,

    Thanks for your advice, but, it did not work for me.

    Apple said it was a UIKit Bug, and they will release it later.

  3. I've had the same problem. I've also seen it listed as a bug, though I haven't seen anything official from Apple on the subject. In any case, switching the target SDK to 3.0 seemed to "fix" the problem for me, in as much as it allows me to build and run.

    Also, this problem plagues Apple's own oalTouch sample app. Hopefully, the final build of the 3.0 SDK will fix these problems.

  4. Thank you Dan,

    But it still did not work for me, even using the latest 3.0 GM Version.

  5. Incidentally, I managed to do something that caused the simulator to stop playing OpenAL audio as well. D'oh!

    I found a solution, but I don't think you'll like it. I decided to do a full Leopard reinstall (which I had been meaning to do for a few months anyway). I didn't use the "Archive and Install" option - I wiped the disk and selectively restored files from a backup. It was a pain, but it made this particular problem go away.

    My best theory (other than simple bit rot) is that some audio software (Audio Hijack, Airfoil, Sound Studio 3, Wiretap Studio) did something to my system's configuration that I couldn't track down. This is a lousy solution, but without better error messages or technical information from Apple, I had no other ideas.

    On another forum, somebody mentioned that they did try a reinstall, but it didn't work for them. I don't remember them saying whether they did an Archive and Install or a clean sweep. So try this solution at your own risk.

  6. Really? You are great! My problem is not that complex, because it worked fine on the device, so I just switched from simulator to real device. Although it will cost some ultra loading time for device.

  7. I'm also still plagued by this... often my "solution" above doesn't work. Sometimes, sound works fine once, then after I quit the simulator and try again, it doesn't work. So lame. Reboot fixes it, one time only though!


  8. Does your app work fine on the device? If it works fine on the device, I suggest just ignore it and debug on the device directly. Although, it will cost some extra time to load your app into the device.

  9. That update worked for me - thanks! I modifed the UILocalizedIndexedCollation.h files for both the iphone and the simulator as mentioned above, and reset my simulator for good measure. No more -66681 error after that.

    Thanks again.

  10. Oh, you made it?

    Please kindly tell me how to do that. I completely have no idea on how to do that.

  11. - Find UILocalizedIndexedCollation.h in spotlight (not as mentioned above).

    - This will bring up 2 instance. I edited both (haven't tested the device uet though). One is for the simulator SDK, the other is for the device SDK.

    - As above, change:
    UIKIT_EXTERN @interface UILocalizedIndexedCollation : NSObject


    UIKIT_EXTERN_CLASS @interface UILocalizedIndexedCollation : NSObject

    - Do a clean, then a rebuild of your app. I also reset the simulator (in the simulator menu) before running. Not sure if it made any difference. I also used the 3.0 SDK.

    Hope this helps.

  12. Cool, I misunderstood the framework mean. I just thought it should be some library or something else that is not editable.

    Let me have a try.

  13. Try to pull out your headphones... It worked for me.

  14. Did not work for me. I just gave up the hope for running on the simulator. Now every time I just run on my device and it worked fine. Thank you.

  15. Building for iPhone OS 3.1 seems to fix this problem for me in the Simulator.

  16. I find this bug only happens for me when my headphones are connected. If I unplug the headphones it runs fine.

  17. That's why I called this exception is weird. Don't when and under what kind of condition it will appear.