couchbaselabs / CouchCocoa

Objective-C API for CouchDB on iOS and Mac OS
http://couchbaselabs.github.com/CouchCocoa/docs/
218 stars 66 forks source link

Newer CouchCocoa not working with CouchEmbeddedServer in my app #51

Open andygold99 opened 11 years ago

andygold99 commented 11 years ago

Hi Jens

I mentioned this on the google group and you asked me to submit the issue here.

I've downloaded and built the latest version of CouchCocoa.framework from here and added it to my app, which previously used a pre TouchDB version of the framework. You said it should compile ok with the CouchEmbeddedServer, but I get an error as soon as I rebuild my app.

In CouchDesignDocument_Embedded.h

import <TouchDB/TDDatabase+Insertion.h> file not found

If I comment it out, then it complains about the file below

import <TouchDB/TDView.h> file not found.

Commenting that out gives me parse errors, so it's not as if I can not use those files and carry on.

I need to be able to compile with a version of CouchCocoa.framework that contains the new armv7 setting to be able to create an IPA under Xcode 4.5 (at the moment it gives up half way through creating the archive file), because when I create the IPA on earlier versions of Xcode, CouchCocoa fails to connect to the server and sync on any iOS 6 devices.

It works fine on pre iOS 6 devices and I can even tether my iPhone with iOS 6 to Xcode 4.5 and build and it works fine. Just not when an IPA has been added to an iOS 6 device for testing via earlier versions of Xcode.

Client has requested that they wish to support pre iOS 5, so i'm having to go down this route. Otherwise I'd be happy to use TouchDB instead.

Regards

Andy

andygold99 commented 11 years ago

For some reason it stripped out the files I referred to, so here they are again

TouchDB/TDDatabase+Insertion.h TouchDB/TDView.h

It doesn't like the brackets <> or something when posting on here!!

andygold99 commented 11 years ago

I have also tried adding the TouchDB framework, which does get rid of the errors I mentioned above, but then it starts complaining about my use of CouchEmbeddedServer in the AppDelegate.

Doing this CouchEmbeddedServer *server; is then an undeclared identifier.

snej commented 11 years ago

Don't import CouchDesignDocument_Embedded.h. It's only meant for use with TouchDB.

(I think I may have added such an #import to CouchCocoa.h; if so that was a mistake. You can comment it out.)

PS: I think the MarkDown processor in these forums recognizes some HTML tags, so don't use angle brackets in plain text. It's best to surround code with backquotes which will leave it unmodified. Or if you have entire lines of code you can indent them by 4 or more spaces or a tab, which will turn them into a code block.

andygold99 commented 11 years ago

Thanks Snej

I have commented that out, which now allows me to remove the TouchDB framework, but i'm still getting the error about CouchEmbeddedServer being undefined.

Any ideas?

snej commented 11 years ago

Did you import <CouchCocoa/CouchEmbeddedServer.h> in your app delegate? It's not imported in CouchCocoa.h because it's no longer a mainstream part of the framework.

andygold99 commented 11 years ago

I added that in and it compiled, but when it tried to start the app up on the device I get an NSAssertion error:

Assertion failure in -[CouchEmbeddedServer init],

This is the line in CouchEmbeddedServer that gets highlighted

// Look up class at runtime to avoid dependency on Couchbase.framework: Class couchbaseClass = NSClassFromString(@"Couchbase");

Any ideas? We are getting there!! :)

snej commented 11 years ago

Are you still using the old/deprecated Couchbase Mobile framework?!

andygold99 commented 11 years ago

Yes, what is the other choice?

snej commented 11 years ago

Sorry, I thought you were just talking to a remote CouchDB server.

That line should say NSClassFromString(@"CouchbaseMobile"); -- the class name "Couchbase" is wrong. I dimly recall that I was going to rename that class at one point, but I never did, and the CouchCocoa code must have ended up in the wrong state. I'll check in a fix.

andygold99 commented 11 years ago

OK, thanks Jens for all your help. I'll wait for the fix as I don't think I can edit the implementation file myself to make that change.

andygold99 commented 11 years ago

Sorry, I just needed to edit the source I downloaded and rebuild the framework. After making that change it now builds and runs. Thanks again for all your help Jens.

I hope to one day play with TouchDB!! :)

andygold99 commented 11 years ago

Sorry Jens, spoke too soon. Now when I run the Archive in Xcode 4.5 I get the error this time with the Couchbase framework.

file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/andygold99/Documents/myApp/Couchbase.framework/Couchbase for architecture armv7s clang: error: linker command failed with exit code 1 (use -v to see invocation)

I just had to fix the problem with the latest Facebook SDK too to get this far lol

Any chance that setting can be added to it? I know it's no longer supported

Thanks

Andy

snej commented 11 years ago

Oh, man. I hate to say this, but you're going to have to try building it yourself. The thing is a pain to build and I really can't justify the time it'll take to open it up again. You shouldn't need to make changes to the project, just build it with Xcode 4.5. Sorry :(

(What fraction of the iOS user base is still on version 4 or lower, anyway? And of those, how many have devices fast enough to be able to tolerate the launch time of Couchbase Mobile?)

andygold99 commented 11 years ago

Thank Jens. You make a lot of sense and the client has agreed to let me use TouchDB.

You may want to document it somewhere on the Couchbase Mobile download, that it no longer works with iOS 6, at least without a lot of messing around.