Note that there are some explanatory texts on larger screens.

plurals
  1. POSave UIDocument to iCloud give me NSCocoaErrorDomain Code=4
    text
    copied!<p>in my app i want write document on iCloud, but i have a problem with one iCloud account, this is the scenario: iCloud Account A, all works perfectly, i can write and read, with iPad and iPhone. iCloud Account B, same as above, i can write and read. iCloud Account C, doens't work, i can't write and read and give me the error.</p> <p>This is a scratch of code:</p> <pre><code>NSURL *ubiqContainer = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; NSURL *ubiquitousPackage = [[ubiqContainer URLByAppendingPathComponent:@"Documents"] URLByAppendingPathComponent:kFILENAME]; MyDocument *mydoc = [[MyDocument alloc] initWithFileURL:ubiquitousPackage]; self.mydoc = mydoc; [mydoc saveToURL:[mydoc fileURL] forSaveOperation:UIDocumentSaveForCreating completionHandler: ^(BOOL success) { //success is always FALSE for the Account C }]; </code></pre> <p>then i have implemented this method:</p> <pre><code>- (void) handleError:(NSError *)error userInteractionPermitted:(BOOL)userInteractionPermitted{ NSLog(@"error: %@", [error description]); NSLog(@"permitted: %d", userInteractionPermitted); } </code></pre> <p>and this is the log:</p> <pre><code>error: Error Domain=NSCocoaErrorDomain Code=4 "The operation couldn’t be completed. (Cocoa error 4.)" UserInfo=0x15ef24f0 {NSFileNewItemLocationKey=file:///private/var/mobile/Applications/2A1F6A00-AA50-4D44-AFA1-89D0CA747EBB/tmp/(A%20Document%20Being%20Saved%20By%20My%20App)/MyApp.esd, NSFileOriginalItemLocationKey=file:///private/var/mobile/Library/Mobile%20Documents/EAYDD3QH5Q~com~mycompany~My-App/Documents/MyApp.esd, NSUnderlyingError=0x15e3c870 "The operation couldn’t be completed. (Cocoa error 4.)", NSURL=file:///private/var/mobile/Library/Mobile%20Documents/EAYDD3QH5Q~com~mycompany~My-App/Documents/MyApp.esd} 2013-10-20 16:53:24.358 My App[222:3707] permitted: 1 </code></pre> <p>i can't understand why doens't work on this account, and on the other works...what is wrong? i have reinstalled all profiles in the device with the account problem, but doesn't work, any idea?</p>
 

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