iCloud and Core Data Error (Ubiquity: Didn't get baseline metadata back from metadata url)
Asked Answered
S

3

49

I'm having a bit of trouble trying to get iCloud working with my app. I tried following Tim Roadley's example here, but still get the log below appearing whenever the app is launched via Xcode (syncing did work briefly, but has ceased to work now).

[PFUbiquityBaseline metadataFromCurrentBaselineForStoreWithName:modelVersionHash:andUbiquityRootLocation:withError:](1091): 
CoreData: Ubiquity:  Didn't get baseline metadata back from metadata url:         
file://localhost/private/var/mobile/Library/Mobile%20Documents/<TEAM
ID>~samburnstone~Staff-Manager/Logs/.baseline/current.nosync/<TEAM 
ID>.samburnstone.StaffManager/g9TNo_uNFuNyltbjcAmDaFE7wl~6a2eGmW6uKIZCC1s=
/baseline.meta Error: (null)

(TEAM ID is my alphanumeric sequence of characters that can be found in Apple's Member Center)

If anyone has any idea what could be causing this I'd be very grateful.

Thanks!

Silo answered 6/8, 2012 at 11:42 Comment(3)
I'm seeing similar problems. still no luck in solving it.Washout
Yeah. iCloud seems to occasionally work correctly and then other times gives me this error. I've given up for now and might give it another go in the future ;)Silo
@Darknight that is pretty much the consensus with iCloud+CoreData :-)Chokebore
C
1

Check if you the following applies to your issue - it helped me: http://mentalfaculty.tumblr.com/post/25241910449/under-the-sheets-with-icloud-and-core-data Without seeing your code it's hard to comment on the actual issue.

Connective answered 10/5, 2013 at 1:48 Comment(0)
M
1

I think the problem is that it needs to be unjammed via a force eviction.

My answer references the User Dictionary, related to Text Input, as a concrete example. This answer has many specific path names which I have kept so it is easy to see context and structure of files/directories, but your paths will be different.

Blogger AtomicBird has looked into iCloud mechanics and shows that the metadata file comes from the baseline.zip file, which can be found and expanded:

find ~/Library/Mobile\ Documents -name baseline.zip
cd $HOME/"Library/Mobile Documents/com~apple~TextInput/Dictionaries/.baseline/UserDictionary"
cd SAlQVUhF7208e6_gvZx_zdKx1U1AzKGem3HO2pLKjgY=

I have file baseline.zip under subdirectory SAlQVUhF7208e6_gvZx_zdKx1U1AzKGem3HO2pLKjgY= in my case.

Unzipping the baseline.zip file shows the metadata in question. If you have the plistutil tool (via brew package manager) you can see its contents:

plistutil -i metadata 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>$version</key>
    <integer>100000</integer>
    <key>$objects</key>
    <array>
.
.

The contents are not documented officially.

When the problem occurred, it must have been related to the contents of this file. The iCloud sync logic has much improved over the last few years but it is still not perfect.

When things are jammed up, we need to force the system to get a fresh file from iCloud.

It is possible to force this via a command line tool, brctl with the evict operation. For example:

brctl evict "/Users/faisalm/Library/Mobile Documents/com~apple~TextInput/Dictionaries/faisalm~79CD0053-95EA-5F84-9773-5D1269B74D13/UserDictionary"

It is also possible to then use the brctl dump command to see how it managed to sync up. I have in my output the snippet referencing UserDictionary

:3 queries: metadata:idle etag:hg apps:{} InCloudDocsZone bundles:{com.apple.inputmethod.TCIM, com.apple.Preferences, com.apple.InputMethodKit.UserDictionary, com.apple.InputMethodKit.TextReplacementService, com.apple.kbd, com.apple.inputmethod.SCIM}>

Once unjammed, it should work ok.

Minnick answered 21/2, 2023 at 17:50 Comment(0)
K
0

You can also try this below code and call it every time you launch the app:

PFUbiquityBaseline metadataFromCurrentBaselineForStoreWithName:modelVersionHash:andUbiquityRootLocation:withError:

if (![[NSFileManager defaultManager] fileExistsAtPath:[[NSURL fileURLWithPath:[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"Logs"]] URLByAppendingPathComponent:@"current.nosync"].path]) { [PFUbiquityBaseline metadataFromCurrentBaselineForStoreWithName:@"AppStore" modelVersionHash:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] andUbiquityRootLocation:[[NSURL fileURLWithPath:[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"Logs"]] URLByAppendingPathComponent:@"current.nosync"] withError:nil]; }
Kcal answered 20/10, 2022 at 5:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.