【问题标题】:'RKManagedObjectRequestOperation' for class message is a forward declaration类消息的“RKManagedObjectRequestOperation”是前向声明
【发布时间】:2016-03-18 02:47:27
【问题描述】:

我决定在这里问这个问题,因为这几天我一直在寻找解决方案。

我刚刚通过 CocoaPods 将 RestKit 集成到我的项目中。我在 iOS 9 上使用 ElCapitan 和 XCode 的最新版本(7.2) 在 XCode 中的构建步骤之前一切正常。

我收到以下错误

类消息的接收者“RKManagedObjectRequestOperation”是前向声明

请看下面产生错误的代码: Code sample

RKManagedObjectRequestOperation *operation = [[RKManagedObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]];
operation.managedObjectContext = managedObjectStore.mainQueueManagedObjectContext;
operation.managedObjectCache = managedObjectStore.managedObjectCache;
[operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *result) {
    //Product *product = [result firstObject];

但是,我认为我正确导入了库 RestKit/CoreData : I declared RestKit/CoreData

而且在前缀标题中:

#import <Availability.h>

#if __IPHONE_OS_VERSION_MIN_REQUIRED

    #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/CoreData.h>
        #import <SystemConfiguration/SystemConfiguration.h>
        #import <MobileCoreServices/MobileCoreServices.h>
    #endif

    #else
        #ifdef __OBJC__
        #import <Cocoa/Cocoa.h>
        #import <SystemConfiguration/SystemConfiguration.h>
        #import <CoreServices/CoreServices.h>
    #endif

#endif

我想就这个问题请求您的帮助。 “实例消息的接收器类型 'RKManagedObjectRequestOperation' 是前向声明。”

我应该在构建设置等中检查什么吗?

【问题讨论】:

    标签: ios core-data ios9 restkit


    【解决方案1】:

    RKManagedObjectRequestOperation 不在 CoreData.h 头文件下,而是在 Network.h 头文件下,所以我将包括在您的列表中:

    【讨论】:

    • 谢谢!其实现在好多了! Grazie Mille
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多