Property 'managedObjectStore' not found on object of type 'RKObjectManager'

只谈情不闲聊 提交于 2019-12-03 09:28:25

I had exactly the same issue when upgrading from 0.20.1 to 0.20.3.

What you need to do is to import CoreData before importing RestKit.

#import <CoreData/CoreData.h>
#import <RestKit/RestKit.h>

is working.

but

#import <RestKit/RestKit.h>
#import <CoreData/CoreData.h>

is not working.

Add in build settings User Header Search Paths "${PROJECT_DIR}/Pods" recursive. This solved the problem in my case.

Aqib Mumtaz

In XCode6 on creating new project "pch" file isn't created by default, I had to create pch file manually following PCH File in Xcode 6

I got it working After importing headers in pch file:

#import <CoreData/CoreData.h>
#import <RestKit/RestKit.h>

Add

#import <CoreData/CoreData.h>  

to your .pch file.

The root cause of this issue is in RKObjectManager.h

#ifdef _COREDATADEFINES_H
#   if __has_include("RKCoreData.h")
#       define RKCoreDataIncluded
#   endif
#endif

This include has changed names so everywhere RKCoreData.h appears change to RestKit/CoreData.h there are several include files that use this construct so do a global search.

If you are upgrading from 0.20 to 0.26 (say, upgrading a very old project that hadn't been updated for years), you may find that both of the following, suggested in other answers, are insufficient:

  • add #import <CoreData/CoreData.h> in pch
  • add #import <CoreData/CoreData.h> before #import <RestKit/RestKit.h>

Instead, at the top of the relevant file where you are importing restkit,

// Workaround for bug on RestKit 0.26.0 according to https://github.com/RestKit/RestKit/issues/2352
#ifndef RKCoreDataIncluded 
#define RKCoreDataIncluded 
#endif
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!