Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Edit:</strong><br> If you are targeting iOS6 or above you can use <code>[[NSFileManager defaultManager] ubiquityIdentityToken];</code>. For usage example please refer <a href="https://stackoverflow.com/a/23557492/149008">@Dj S' answer</a> :).<br> It is faster and easier than the original solution which was meant for people targeting iOS5 and above</p> <p><strong>Original Answer</strong><br> As documented in <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/index.html#//apple_ref/occ/instm/NSFileManager/URLForUbiquityContainerIdentifier:" rel="nofollow noreferrer">iOS App programming guide - iCloud Storage</a>. That can be checked by asking the ubiquity container URL to the file manager :)</p> <p>As long as you supply a valid ubiquity container identifier below method should return YES</p> <pre><code>- (BOOL) isICloudAvailable { // Make sure a correct Ubiquity Container Identifier is passed NSURL *ubiquityURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:@"ABCDEFGHI0.com.acme.MyApp"]; return ubiquityURL ? YES : NO; } </code></pre> <p>However, I've found that <code>URLForUbiquityContainerIdentifier:</code> might take several seconds the very first time within a session (I used it in iOS5 so things might be different now). I remember using something like this:</p> <pre><code>dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(backgroundQueue,^{ BOOL isAvailable = [self isICloudAvailable] /* change to the main queue if you want to do something with the UI. For example: */ dispatch_async(dispatch_get_main_queue(),^{ if (!isAvailable){ /* inform the user */ UIAlertView *alert = [[UIAlertView alloc] init...] [alert show]; [alert release]; } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload