0

So I'm trying to get ObjCMongoDb up and running in an iOS application but I keep getting this error.

ignoring file /Users/user/Documents/Programming/ObjCMongoDB/ObjCMongoDB.framework/ObjCMongoDB, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7): /Users/user/Documents/Programming/ObjCMongoDB/ObjCMongoDB.framework/ObjCMongoDB
Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_BSONDecoder", referenced from:
      objc-class-ref in MongoDbConnection.o
  "_OBJC_CLASS_$_MongoKeyedPredicate", referenced from:
      objc-class-ref in MongoDbConnection.o
  "_OBJC_CLASS_$_MongoUpdateRequest", referenced from:
      objc-class-ref in MongoDbConnection.o
  "_OBJC_CLASS_$_MongoConnection", referenced from:
      objc-class-ref in MongoDbConnection.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have a feeling that this means that the framework was not compiled for iOS but for Mac OS X.

Does anyone know how to integrate ObjCMongoDb into an iOS application?

Thanks!

Lucas Eduardo
  • 11,525
  • 5
  • 44
  • 49
adeiji
  • 550
  • 1
  • 3
  • 13

1 Answers1

1

To use a framework on iOS you need to build it as a static library, which the Xcode project that's part of ObjCMongoDB doesn't provide a way to do.

The simplest way is to follow the instructions for getting started on Mac OS, which should work equally well on iOS.

paulmelnikow
  • 16,895
  • 8
  • 63
  • 114
  • I'm a little confused with this doc. It tells me to add the six files bson.c, encoding.c etc. Where does it want me to add these files? They're already added to the project, because when I run right now I get 100 errors. – adeiji Aug 20 '13 at 19:39
  • Ok I got it to work. Thanks for the help. I needed to add the necessary files, bson.c, encoding.c, numbers.c, mongo.c, md5.c, env.c, gridfs.c and bcon.c to the target. I added them to the project but then forgot to add them to the target. Thanks again. – adeiji Aug 20 '13 at 20:37
  • 1
    Cool. The project soon will support CocoaPods which may result in a much simpler process. – paulmelnikow Aug 21 '13 at 04:25
  • Hey I'm having another issue. So I have everything set up like it says to do on GitHub, but for some reason I can't connect to MongoDb on the local server. I have the IP set to 127.0.0.1, with the correct collection name. Is there another step that's not in the documentation that I'm missing here? – adeiji Aug 21 '13 at 05:10
  • Would you post a new question? – paulmelnikow Aug 21 '13 at 12:17