解决方法
只需添加名为NSUbiquityIdentityDidChangeNotification的通知的观察员
[[NSNotificationCenter defaultCenter] addobserver: self selector: @selector (iCloudAccountAvailabilityChanged:) name: NSUbiquityIdentityDidChangeNotification object: nil];
If a user signs out of iCloud,such as by turning off Documents & Data
in Settings,the ubiquityIdentityToken method returns nil. To enable
your app to detect when a user signs out and signs back in,register
for changes in iCloud account availability. – Apple Documentation