Realm-cocoa: Realm not loading when built as a Command Line tool project

Created on 6 Oct 2014  路  3Comments  路  Source: realm/realm-cocoa

I've tried setting up from scratch the JSONImport example by following the instructions at http://realm.io/docs/cocoa/0.86.0/#getting-started. I'm using Xcode 6 (from App Store) on Mac OSX 10.9 with the latest Realm download (0.86.1). I create the terminal command line project, follow the installation instructions (used OSX Realm build, Objc), import Realm and just ran it with the following code to see if I could avoid an error I encountered last week:

#import <Foundation/Foundation.h>
#import <Realm/Realm.h>

int main(int argc, const char * argv[]) {
  @autoreleasepool {
    // insert code here...
    NSLog(@"Hello, World!");
  }
  return 0;
}

When running the tool from Xcode I get the following error which I also had with the previous Realm release:

dyld: Library not loaded: @rpath/Realm.framework/Versions/A/Realm
  Referenced from: /Users/javierjulio/Library/Developer/Xcode/DerivedData/realm-database-generator-curihjvfvkcmridupzfiguszklkf/Build/Products/Debug/realm-database-generator
  Reason: image not found
Program ended with exit code: 9

Could the installation instructions just not be applicable for a project built just like the JSONImport example? If there's more info I can provide let me know. Happy to help.

Most helpful comment

Hi @javierjulio, you're right that the installation instructions at http://realm.io/docs/cocoa/latest/#installation don't work for command-line OSX apps, since they have no bundle!

What we do for the JSONImport example is to link Realm.framework and then copy it into the Products directory:
image

All 3 comments

Hi @javierjulio, you're right that the installation instructions at http://realm.io/docs/cocoa/latest/#installation don't work for command-line OSX apps, since they have no bundle!

What we do for the JSONImport example is to link Realm.framework and then copy it into the Products directory:
image

Closing as my previous comments was confirmed to have worked: https://github.com/realm/realm-cocoa/issues/1000#issuecomment-58699500

I am solved this added framework in embedded binary see : http://iosdevcenters.blogspot.in/2015/12/realm-error-dyld-library-not-loaded.html

Was this page helpful?
0 / 5 - 0 ratings