如何检测用户是否为我的应用启用了iCloud? [英] How to detect if the user has iCloud enabled for my app?

查看:544
本文介绍了如何检测用户是否为我的应用启用了iCloud?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了支持iCloud的iPhone应用程序,但我遇到的问题是,即使用户为我的应用程序关闭iCloud备份,它也会重新启动iCloud并反映我的其他设备上的更改,所以我想要知道我怎么能得到我的应用程序启用iCloud。它专门用于App not for Device,如果设备已启用iCloud但我的应用程序已关闭,那么它不应该进行任何备份,请帮助我们。

I have developed an iCloud enabled iPhone App, but the issue I m facing is that even if user turn off iCloud backup for my App then also it takes back up on iCloud and reflect changes on my other devices, so I want to know that how can I get that my App is iCloud enabled or not. its specifically for App not for Device, if device is iCloud enabled but my App is turned off then it should not take any back ups, pls help me guys.

Thanx in提前。

Thanx in advance.

推荐答案

请使用它来检查iCloud的状态是否已启用。

Please use this to check the status of your iCloud whether it is enabled or not .

NSFileManager *fileManager = [NSFileManager defaultManager]; 
NSURL *iCloudURL = [fileManager URLForUbiquityContainerIdentifier:nil]; 
NSLog(@"%@", [iCloudURL absoluteString]); 

if(iCloudURL){ 
NSUbiquitousKeyValueStore *iCloudStore = [NSUbiquitousKeyValueStore defaultStore]; 
[iCloudStore setString:@"Success" forKey:@"iCloudStatus"]; 
[iCloudStore synchronize]; // For Synchronizing with iCloud Server 
NSLog(@"iCloud status : %@", [iCloudStore stringForKey:@"iCloudStatus"]); 
}

这将告诉您它是否为ON / OFF:)

This will tell you whether it is ON/OFF :)

这篇关于如何检测用户是否为我的应用启用了iCloud?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆