0

I have the following piece of code and am trying to access iCloud directory.

(void) reloadFiles{
    NSFileManager *fileManager = [NSFileManager defaultManager]; 

    NSString *containerID=@"KSC75JA957.Dcdmc.TinyPix";

    NSURL *cloudURL = [fileManager URLForUbiquityContainerIdentifier:nil];

    NSLog(@"got cloudURL %@", cloudURL); 

    self.query = [[NSMetadataQuery alloc] init];

    query.predicate = [NSPredicate predicateWithFormat:@"%K like '*.tinypix'", NSMetadataItemFSNameKey];

    query.searchScopes = [NSArray arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope];

    [query startQuery];                       
}

However, when i run my application I am unable to get the cloud url. And am getting the following errors.

 got cloudURL (null)

 item update error: 0, Error

 Domain=LibrarianErrorDomain Code=10 "The operation couldn’t be completed. 

(LibrarianErrorDomain error 10 - Unable to configure the collection.)"

 UserInfo=0xce65470 {NSDescription=Unable to configure the collection.}
Jake1164
  • 12,291
  • 6
  • 47
  • 64
Amrita
  • 65
  • 1
  • 3
  • 9
  • Are you going to use cloudURL? If that's the case, maybe the NIL-identifier has something to do with it? – Jens Bergvall Jun 26 '12 at 12:28
  • I had tried using the container identifier instead of 'nil' but I still got the same error. So i guess, that's not the issue. – Amrita Jun 26 '12 at 12:36
  • when the `cloudURL` is `nil` means the iCould service is not available on that device. – holex Jul 24 '12 at 15:24

3 Answers3

1

"Unable to configure the collection" means that Documents syncing is somehow disabled.

Are you signed into iCloud and do you have Documents & Data enabled? cloudURL will be nil if Documents syncing is not enabled for one of these two reasons.

If cloudURL is nil, you should not attempt to use iCloud.

Thomas Deniau
  • 2,488
  • 1
  • 15
  • 15
1

You sure that you enabled icloud on the device? Refer this:

this is the error that occurs when you haven't enabled iCloud on the device on which you are testing. once i enabled iCloud on the device, the error stopped occurring in my log.

and so now i know what error to check for in order to present the user with a dialog saying "connecting to iCloud won't work until you sign up for iCloud in the system preferences".
Community
  • 1
  • 1
Jacob
  • 2,041
  • 14
  • 16
1

You need to enable the iCloud support for your App on the developer portal web site first off all.