4

There are related questions on SO, such as this one, and while this issue is mentioned, it is not the crux of that question or any of the others I could find.

I have written an iOS 8.1 application called Cloudy, which is just a test bed for learning Core Data for iCloud. The documentation says that to detect a change in iCloud account status, one should listen for NSUbiquityIdentityDidChangeNotification and then examine the value of NSFileManager's ubiquityIdentityToken property. Conceptually, this is very simple and straightforward. The problem is that it never happens.

Instead, my application always receives SIGKILL when I sign out of iCloud or disable iCloud Documents. In some of the comments to the linked SO question above, some guessed that this occurs only when debugging through Xcode, but I can assure you this is not the case. It also occurs when simply launching the app without a debugger connected.

Now, SIGKILL is just fine. In fact, it makes my life easier. The problem is that I cannot find this behavior documented anywhere, so I don't trust it. However, since I have never been able to capture NSUbiquityIdentityDidChangeNotification, it is impossible to test any code written to handle it.

While iCloud is a great technology, the documentation for it is maybe half a notch above terrible.

Community
  • 1
  • 1
Gregory Higley
  • 15,923
  • 9
  • 67
  • 96
  • I have suspicion that this is related to testing in XCode. Are you getting the same if you test on real device ? – Lubos Jun 25 '15 at 15:53
  • I started to get this behaviour when I switched my app from iOS7 to 8. I have also tried on my phone debugging from Xcode, and it fails with the same SIGKILL. – DaveDude Jul 11 '15 at 16:43
  • 3
    Did some more digging around and testing on this. When a user logs out of a privileged service such as iCloud, a SIGKILL will be sent. This is the expected behaviour. On the device, the app is killed, and then restarted. I guess the thinking is that the heavy hammer is better in this case, as the app will determine if someone is logged in/out on startup. However, when you log into iCloud, no SIGKILL is sent - so you still need to use the Notification Center to get this change as per the Apple documentation. So the logout/login behaviour is asymetric – DaveDude Jul 12 '15 at 02:47

0 Answers0