2013-06-04 60 views
1

我試圖將StackMob添加到我的項目中。它說在將SDK拖到項目後,創建一個SMClient實例,檢查「爲...創建組」並添加到目標。我跟着這些steps接收者'SMClient'類消息是一個前向聲明

然而,當我創建我的SMClientSMCoreDataStore情況下,它給我的Receiver '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; 
} 

我已經清理項目,引進相關的頭文件,但它仍然給出了錯誤。

任何想法?

回答

7

這可能是因爲忘記導入類而發生的。 將它添加到您的.m上:

#import "SMClient.h" 
#import "SMCoreDataStore.h" 
+0

修復它!但是這很奇怪,因爲'StackMob.h'導入了這兩個類,但是如果我只導入該頭文件,它會給我那個錯誤。 – swiftcode

相關問題