Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Works well but fails when transaction log has multiple changes in same entity #1

Open
msec opened this issue Jun 24, 2012 · 1 comment

Comments

@msec
Copy link

msec commented Jun 24, 2012

First of all I would like to thank you chbeer. This is truly an exellent tool which will assist me in troubleshooting iCloud.

I have found 1 problem with it, which if fixed, would make your solution perfect in my eyes.

The iCloudCDT plugin seems to be able to cope well in reading transaction logs relating to insert, update and delete. It can also cope when a transaction log is generated showing a single change to multiple entities.

Where the plugin fails is when multiple changes occur on a single entity in one transaction log. For instance I have a method which deletes all the objects in a table and iCloudCDT is unable to read the transaction log generated by this.

I have another method which updates a value in all of the objects in a table and likewise the plugin fails to be able to read the corresponding transaction log.

It can however read the transaction log of single deletes from the table or single updates. I just thought I would let you know as you may not have encountered this in your testing.

@zulfishah
Copy link

You need to add this with the primaryKeys and entityNames array declarations:

NSArray *compressedGlobalIDs = [cdtDictionary valueForKeyPath:@"compressedGlobalIDs"];

Then, in the block declaration, use this:

        NSString *compressedGlobalID = [compressedGlobalIDs objectAtIndex:entityIndex];

        int entityNumber = [[compressedGlobalID substringWithRange:[compressedGlobalID rangeOfComposedCharacterSequenceAtIndex:0]] intValue];
        NSString *entityName  = [entityNames objectAtIndex:entityNumber];

        int primaryKeyNumber = [[compressedGlobalID substringWithRange:[compressedGlobalID rangeOfComposedCharacterSequenceAtIndex:2]] intValue];
        NSString *primaryKey  = [primaryKeys objectAtIndex:primaryKeyNumber];

Reference: http://mentalfaculty.tumblr.com/post/23231176783/under-the-sheets-with-icloud-and-core-data-how-it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants