Reputation: 5939
In my app, It is showing some error like :
"unknown type name 'purchasedViewController'; DId you mean 'UIPageViewController'?
But actually there is a VC named purchasedViewController
and i have imported it in the current VC.
But when i create an object of purchasedViewController
in the current VC like:
@property(strong, nonatomic) purchasedViewController *purchasedController;
im getting an error message saying :
"unknown type name 'purchasedViewController'; DId you mean 'UIPageViewController'?
Why is it happening?Any idea?
**************EDIT************** This is my ".h" file
#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
#import "PurchasedViewController.h"
@interface MainScreenViewController : UIViewController
- (IBAction)purchaseItemAction:(id)sender;
@property (strong, nonatomic) IBOutlet UILabel *Label;
@property(strong,nonatomic) PurchasedViewController *purchaseController;
-(void)Purchased;
@end
Upvotes: 0
Views: 357
Reputation: 9965
You might have a problem if somehow headers are importing each other. To avoid that, change the import in your header to look like this:
//MainScreenViewController.h
#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
@class PurchasedViewController;
@interface MainScreenViewController : UIViewController
...
This will tell the header that the class exist but not actually importing it.
Then, in the implementation (.m
) file of MainScreenViewController
you can actually call the import:
//MainScreenViewController.m
#import "PurchasedViewController.h"
...
Upvotes: 1
Reputation: 22364
Try to give Forward declaration like
@class purchasedViewController;
@interface MainScreenViewController : UIViewController
@end
I think it works for you
Upvotes: 2