Uiviewcontroller 视图控制器错误

Uiviewcontroller 视图控制器错误,uiviewcontroller,error-handling,Uiviewcontroller,Error Handling,“未知类型名称‘ViewController’您是指‘UIViewController’” 这就是我犯的错误 #import <UIKit/UIKit.h> #import <StoreKit/StoreKit.h> #import "ViewController.h" @interface PurchaseViewController : UIViewController <SKPaymentTransactionObserver, SKProductsRequ

“未知类型名称‘ViewController’您是指‘UIViewController’”

这就是我犯的错误

#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
#import "ViewController.h"

@interface PurchaseViewController : UIViewController <SKPaymentTransactionObserver, SKProductsRequestDelegate>
@property (weak, nonatomic) IBOutlet UILabel *productTitle;
@property (weak, nonatomic) IBOutlet UIButton *buyButton;
@property (weak, nonatomic) IBOutlet UITextView *productDescription;
- (IBAction)buyProduct:(id)sender;
@property (strong, nonatomic) SKProduct *product;
@property (strong, nonatomic) NSString *productID;
@property (strong, nonatomic) ViewController *homeViewController; //error here
- (void)getProductInfo:(UIViewController *)viewController;
@end
#导入
#进口
#导入“ViewController.h”
@接口PurchaseViewController:UIViewController
@属性(弱、非原子)IBUILabel*productTitle;
@属性(弱,非原子)IBUIButton*buyButton;
@属性(弱、非原子)IBOutlet UITextView*productDescription;
-(iAction)buyProduct:(id)发件人;
@性质(强,非原子)SKProduct*产品;
@属性(强,非原子)NSString*productID;
@属性(强,非原子)ViewController*homeViewController//这里出错
-(void)getProductInfo:(UIViewController*)viewController;
@结束

@interface
语句之前,放一行如下:

@class ViewController;

看看这是否有帮助。

您需要导入cocoa库

#import <Cocoa/Cocoa.h>
#导入

这应该可以解决问题。

请将此问题格式化为一个问题,并告诉我们您尝试了什么。您能给我们看一下ViewController.h吗?