0

I've spent over 6 hours on this issue by now and really need help. The RKCatalog example that I have compiles fine. But when I try to include the examples into my standalone project, I'm having all kinds of issues:

When I run the example from my main project, I get this exception: 2012-03-06 11:18:18.689 Tracker[1502:707] +[Article count:]: unrecognized selector sent to class 0xdaac4

This tells me that the selector is being sent to the NSManagedObject class, which does not have the ActiveRecord category applied to it. I simply cannot find where to put the import of NSManagedObject+(ActiveRecord) to make it work. I tried as high as the prefix header, but still no luck.

Do I need to import the libraries from the rest kit project into the main project and put them into the "Build phases>Link binary with libraries"? I've done so and moved the rest kit libraries on top of the regular frameworks.

Do I need to include the core data framework if I"m already using a core data library from the rest kit? I currently have both in the "Link binary with libraries". Removing core data causes errors from the rest kit core data library.

Do I need to set header or library search paths to the rest kit folder if I'm already importing libraries from that project? I tried multiple folders for the derived data, and can confirm that the headers exist there.

I cannot add #import "RestKit.h" into the prefix header. It says that it cannot find the file. I can however add #import <RestKit/RestKit.h> or #import "RestKit/RestKit.h" Here's what in my prefix file right now:

#import <Availability.h>

#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif



#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import <RestKit/RestKit.h>
    #import <RestKit/CoreData/CoreData.h>
    #import "RestKit/CoreData/NSManagedObject+ActiveRecord.h"

#endif

I know it has to be something really simple, but I keep spending hours on this issue and just cannot see it. The RKCatalog project works without so much customization. WHat am I doing wrong with my project settings?

Thank you for any help!

Alex Stone
  • 46,408
  • 55
  • 231
  • 407

2 Answers2

2

This has come up before

Calling method on category included from iPhone static library causes NSInvalidArgumentException

There's an "other linker flag" you probably need to set: -all_load

Community
  • 1
  • 1
JeremyP
  • 84,577
  • 15
  • 123
  • 161
0

I have just experienced similar problem in Xcode 4.2. I guess my situation is somehow different and setting the flags did not help, what helped was deleting the original NSManagedObject subclass (not the category) and then generating it anew from the

YourModelName.xcdatamodeld > Editor > Create NSManagedObject Subclass

or

File > New > NSManagedObject subclass

i--
  • 4,349
  • 2
  • 27
  • 35