removeObjectAtIndex: crash when changing 'Allow apps to store documents'

My app uses CloudKit. If you go to the Settings App while my app is running and, in the Settings App, you switch the 'Allow apps to store documents and data in iCloud' switch for my app on (or off) I get a crash:


Last exception Backtrace (0)

_exceptionPreprocess

-[__NSArrayM removeObjectAtIndex:]

0x100068000

_dispatch_call_block_and_release

UIAplicationMain

0x100068000

start


It works fine when restarted in the new on (or off) switch setting.

I have protected all 'removeObjectAtIndex' references so I don't think it is from my code.


Does anyone no what to do about this? Does anyone have a similar problem? Does anyone NOT have this problem?

Replies

I can confirm the problem but the symptoms are different for me. When I toggle the switch in Settings.app while I have my app running, Xcode enters the debugger and I can't use the app switcher to get to my app. In fact, the app switcher hangs until I press ⌘. in Xcode. Then suddenly my app is responsive again and running properly, but Xcode obviously has disconnected from it. At that stage, though, the app handles the account status properly, so it looks more like a problem with Xcode.