pmj / objective-vcdiff

Objective-C wrapper for Google's open-vcdiff binary diff library
28 stars 8 forks source link

Request for example Xcode App #1

Closed pablonosh closed 13 years ago

pablonosh commented 13 years ago

Hi

I love the project, but finding it hard to integrate the project into Xcode. I'm following your detailed instructions, but unfortunately there are lots of compilation errors, typically failing to find files included with the openvc code.

Could you help?

Thanks

Peter

pmj commented 13 years ago

Hi Peter,

Sorry about that, I just tested it out and my instructions were definitely incomplete. I've updated them, it should now be possible to get everything to build by following them. You didn't say whether you were trying to build for OS X or iOS, but it's extremely similar. I've added an XCode project for a static iOS library to the new objective-vcdiff-ios directory, along with the contents of the latest open-vcdiff tarball. You only need to run ./configure in the open-vcdiff directory, and then the XCode project should work.

Let me know if you have any more trouble.

Regards, phil

pablonosh commented 13 years ago

Hi Phil

Thanks for the xcode proj - yes building a library is a great idea. I'm now battling trying to get a new file generated. Do you see anything alarmingly wrong with this:

    NSString * dictionaryFile = [[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"1.sqlite" ];
    NSFileHandle *handle =  [NSFileHandle fileHandleForWritingAtPath:[[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"2.sqlite"] ];

    VCDiffDecoder *b =     [VCDiffDecoder diffDecoderWithMMappedDictionaryAtPath:dictionaryFile writingOutputTo:handle];

    [b decodeData:[NSData dataWithContentsOfFile:[[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"1-2.delta"]]];

    [b finishDecoding];
    [handle synchronizeFile];
    [handle closeFile];

I've created an empty output file, so the filehandle at line 2 has a non-nil reference but no diffed file is generated. Any thoughts?

Oh I forgot to answer but I'd like to use this for an iOS project!

pmj commented 13 years ago

This looks pretty close to how I use the library in my apps. Things to try: make sure the [NSData dataWithContentsOfFile:] call is indeed returning a data object (create a temporary variable and check it is non-nil in the Debugger). Check the return value of decodeData: - it should return YES upon success. Finally, look at the console output. If open-vcdiff itself runs into any problems, it will complain on stderr, which is written to XCode's "Console" window. Hope that helps.

pablonosh commented 13 years ago

Hi Phil

Yes - everything is working. I re-generated my delta and it worked.

Thanks for your moral support! I'll copy my lessons to a wiki page!

Peter

pmj commented 13 years ago

Excellent, glad you could make it work! By the way, if you're sending vc-diffs of uncompressed data over the air, there are some substantial gains to be made by gzipping the deltas and streaming them through zlib directly into objective-vcdiff.