Search code examples
iosipadcore-dataicloudmagicalrecord

iCloud suddenly times out and cannot download files


I use iCloud to store Core Data information for an iPad app. I use the helper methods provided by Magical Record to handle everything Core Data related.

Yesterday my app started to behave strange when accessing Core Data. The app would freeze completely and spend much time loading even though the database was completely empty (clean install of the app). After waiting several minutes it would give an error saying that iCloud had timed out. The following error was given:

-[PFUbiquitySafeSaveFile waitForFileToUpload:](268): CoreData: Ubiquity:  <PFUbiquityPeerReceipt: 0x1f85c580>(0)
    permanentLocation: <PFUbiquityLocation: 0x1f85c5d0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/receipt.0.cdt
    safeLocation: <PFUbiquityLocation: 0x1f85ce30>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C.0.cdt
    currentLocation: <PFUbiquityLocation: 0x1f85ce30>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C.0.cdt

    kv: (null)

Safe save failed for file, error: Error Domain=NSCocoaErrorDomain Code=512 "The file upload timed out." UserInfo=0x1f85d520 {NSLocalizedDescription=The file upload timed out.}
2013-01-03 16:03:35.276 MyAppName[188:1503] +[MagicalRecord(ErrorHandling) defaultErrorHandler:](0x12059c) Error: The file upload timed out.
2013-01-03 16:03:35.277 MyAppName[188:1503] +[MagicalRecord(ErrorHandling) defaultErrorHandler:](0x12059c) Error Message: The file upload timed out.
2013-01-03 16:03:35.278 MyAppName[188:1503] +[MagicalRecord(ErrorHandling) defaultErrorHandler:](0x12059c) Error Domain: NSCocoaErrorDomain
2013-01-03 16:03:35.280 MyAppName[188:1503] +[MagicalRecord(ErrorHandling) defaultErrorHandler:](0x12059c) Recovery Suggestion: (null)
2013-01-03 16:03:35.296 MyAppName[188:907] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x3ade92a3 0x356bf97f 0x3ad33e8d 0xb3db3 0x35e3f11f 0x35e3e4b7 0x35e431bd 0x3adbcf3b 0x3ad2febd 0x3ad2fd49 0x3a4b72eb 0x36879301 0x4fa7d 0x4fa18)
libc++abi.dylib: terminate called throwing an exception
(lldb)

I read several posts saying that iCloud could behave oddly and it was best to just try and wait. That's what I did and when I tried today 18 hours later more or less the same thing happened.

First, it gave me another error when I launched the app. This occurs when launching the app, because I configure Core Data and iCloud in -application:didFinishLaunchingWithOptions:. I got the following error:

-[_PFUbiquityRecordsImporter rollResponseOperation:encounteredAnError:whileTryingToAdoptBaseline:](1509): CoreData: Ubiquity:  <PFUbiquityBaselineRollResponseOperation: 0x1e0b3540> localPeerID: mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C, storeName: com.mydomain.MyAppName, modelVersionHash: HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=
    ubiquityRootLocation: <PFUbiquityLocation: 0x1cdb8650>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName

Encountered an error while trying to respond to the roll of baseline: <PFUbiquityBaseline: 0x1e0b4aa0>(0)
    permanentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip
    safeLocation: <PFUbiquityLocation: 0x1e0b33a0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C
    currentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip

    storeName: com.mydomain.MyAppName
    modelVersionHash: HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=
    baselineArchiveLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip

Error: Error Domain=NSCocoaErrorDomain Code=134310 "The operation couldn’t be completed. (Cocoa error 134310.)" UserInfo=0x1e0b8c40 {baseline=<PFUbiquityBaseline: 0x1e0b4aa0>(0)
    permanentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip
    safeLocation: <PFUbiquityLocation: 0x1e0b33a0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C
    currentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip

    storeName: com.mydomain.MyAppName
    modelVersionHash: HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=
    baselineArchiveLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip
, localStoreKV=<PFUbiquityKnowledgeVector: 0x1e0b90c0> ()}
userInfo: {
    baseline = "<PFUbiquityBaseline: 0x1e0b4aa0>(0)\n\tpermanentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip\n\tsafeLocation: <PFUbiquityLocation: 0x1e0b33a0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C\n\tcurrentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip\n\n\tstoreName: com.mydomain.MyAppName\n\tmodelVersionHash: HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=\n\tbaselineArchiveLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip\n";
    localStoreKV = "<PFUbiquityKnowledgeVector: 0x1e0b90c0> ()";
}

Now, after trying several solutions mentioned on forums (e.g. clean build, reinstall app, remove iCloud data and so on), I am getting the same error as yesterday.

I really can't figure out why this is occurring. I don't remember having done anything with the iCloud configuration. I have updated my data model but this shouldn't really matter after having done a clean install of the app, removed all previous iCloud data and what not.

I hope someone can help me get closer to why these errors occur.


Solution

  • This appears to be a known issue with iCloud right now. It's been working intermittently for my app using CoreData and iCloud. Lots of Error Domain=NSCocoaErrorDomain Code=512 "The file upload timed out." It may have absolutely nothing to do with your app and more to do with the iCloud servers. I've been following a thread on the developer forums that point it to being errors on Apple's side. (At least for problems since Dec 30/31) Here's that discussion:

    Link to discussion thread 176739