我正在尝试将StackMob添加到我的项目中。它说在将SDK拖到项目中之后,创建一个SMClient实例,检查“为...创建组”并添加到目标。我遵循了这些steps

但是,当我创建SMClientSMCoreDataStore实例时,它给我带来了Receiver 'SMClient' for class message is a forward declarationSMCoreDataStore的错误。这是我的代码:

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

@class SMClient;
@class SMCoreDataStore;

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (strong, nonatomic) SMCoreDataStore *coreDataStore;
@property (strong, nonatomic) SMClient *client;

@end

还有我的.m的一部分:
#import "AppDelegate.h"
#import "StackMob.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.client = [[SMClient alloc] initWithAPIVersion:@"0" publicKey:@"YOUR_PUBLIC_KEY"];
    self.coreDataStore = [self.client coreDataStoreWithManagedObjectModel:self.managedObjectModel];

    return YES;
}

我已经清理了项目,导入了相关的头文件,但是仍然会出现该错误。

有任何想法吗?

最佳答案

发生这种情况是因为您忘记了导入类。
将其添加到您的.m:

#import "SMClient.h"
#import "SMCoreDataStore.h"

10-08 01:35