簡體   English   中英

類消息的接收方“ SMClient”是前向聲明

[英]Receiver 'SMClient' for class message is a forward declaration

我正在嘗試將StackMob添加到我的項目中。 它說在將SDK拖到項目中后,創建SMClient實例,選中“為...創建組”並添加到目標。 我遵循了這些步驟

但是,當我創建我的SMClientSMCoreDataStore實例時,它給我一個錯誤, Receiver 'SMClient' for class message is a forward declarationReceiver 'SMClient' for class message is a forward declaration和對於SMCoreDataStore相同。 這是我的代碼:

#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"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM