Unknown type name Error Iphone - iphone

It's giving the UNKNOWN TYPE NAME error. I had imported "billSummary" class as well, but don't know why xcode giving this error.
#import <UIKit/UIKit.h>
#import "customiseForItems.h"
#import "billSummary.h"
#interface itemsInParty : UITableViewController<UIAlertViewDelegate>{
IBOutlet customiseForItems *tblCell;
IBOutlet UIToolbar *billSummaryTool;
CGFloat percValue;
billSummary *billSummaryToShow; //ERROR UNKNOWN TYPE NAME BILL SUMMARY
UIAlertView *alertForPercentage;
NSMutableArray *selectedEntriesPath;
BOOL descTapped;
}

Write #class billSummary; instead of #import "billSummary.h"
Try like this it will be helpful to you.

one possible reason is:
billSummary.h
#interface billSummaryMisspelled : ParentClass
#end
billSummary.m
#implementation billSummaryMisspelled
#end
your file name != to you class name
you can use forward class declaration to skip the error,
#class billSummary;
instead of #import

Related

Unknown type name 'XMLParser'; did you mean 'NSXMLParser'?

Why I get this error "Unknown type name 'XMLParser'; did you mean 'NSXMLParser'?" ? I have imported XMLParser.h, so I can't understand what the problem is.
#import <UIKit/UIKit.h>
#import "XMLParser.h"
#import "televisionList.h"
#import "ListingCell.h"
#interface TelevisionDetail : UIViewController <UITableViewDataSource, UITableViewDelegate>
{
XMLParser *xmlParser;
}
#end
Seems like Xcode bug, but also it's a good practice to avoid unnecessary import in .h file.
So try to add this before #interface..:
#class XMLParser;
And add #import "XMLParser.h" in your .m file.

error instantiating other view controllers

I am sure this is really dumb, but I just cant seem to understand why am I getting this error. In my project I have a view controller and another class that does some data structuring job (not relevant anyway). I am getting a compilation error: "unknown type name "the view controller"" when trying to instantiate it within my class.
This is my class .h:
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import "MyLocationController.h"
#import "GetZip.h"
#import "SecondTab.h"
#interface DataEngine : NSObject <MyLocationControllerDelegate, MKMapViewDelegate, GetZipcodeDelegate> {
MyLocationController *CLController;
GetZip *getzip;
SecondTab *secondTab; //ERROR IS HERE
}
My view controller .h:
#import <UIKit/UIKit.h>
#import "FirstTab.h"
#import "DataEngine.h"
#interface SecondTab : UIViewController <UITableViewDelegate, UITableViewDataSource> {
IBOutlet UITableView *table1;
NSString *address;
NSDate *time;
NSDictionary *dataDict;
DataEngine *fullData;
}
(I omitted all the #synthesis since I dont think they matter...in any case, I do #property (nonatomic, retain) for everything).
Any idea what can go wrong here?
Why don't you try to forward declare it. Use #class secondTab instead of #import secondTab? It will help avoiding any circular inclusions if thats the problem.

Expected specifier-list before "MainViewController / Method -x not found return type defaults to id

I have the following imports in my EquivalenceClassGroup
#import "MainViewController.h"
but then in my property in EquivalanceClassGroup.h:
#property (nonatomic, assign) MainViewController *myController;
I get this error: "Expected specifier-list before MainViewController when compiling
If I change the import to: #class MainViewController and comment out the import of MainViewController.h that error goes away but then then XCode can't find the methods in my MainViewController from EquivalenceClassGroup.m so from here:
-(id)initWithLetterNumbers: (int)numOfLettersInWord enteredLetter: (NSString *) str controller:(UIViewController *)controller {
myController = (MainViewController *) controller;
letterArray = [myController getLetterArray];
[myController getLetterArray];
I get: "Method -getLetterArray not found return type defaults to id" on that last line
I have this method defined in the MainViewController: -(NSArray*)getLetterArray;
and there are no errors in that interface file or the m file. In the equivalence class if I type in [myController then space, I cant seem to find any methods.
From the MainViewController class I do import the EquivalenceClassGroup and use the methods without any problems
You have to make sure that you import the MainViewController.h file in your .m file. All the #class does is tell the interface that there is such a class, but it doesn't tell it anything about the class. That is what #import essentially does. The #class in the .h file is just good programming practice to make sure that you are doubling importing or anything. Hope that helps!
I think you have to write #import "MainViewController.h" in EquivalanceClassGroup.h file and
#class MainViewController in MainViewController.h file.
#class MainViewController
in your EquivalenceClassGroup.h
#import "MainViewController.h"
in EquivalenceClassGroup.m
This is called "forward declaration" and is quite common.

Objective C Properties

I tried searching for this issue, but can't seem to find out what I'm doing wrong.
Here is my controller header:
#import <UIKit/UIKit.h>
#interface BabyLearnViewController : UIViewController {
UIButton *btnImage;
MediaManager* myMediaManager;
}
#property (nonatomic, retain) IBOutlet UIButton *btnImage;
#property (retain) MediaManager* myMediaManager;
- (IBAction)setNewImage;
#end
Here is my controller class:
#import "BabyLearnViewController.h"
#import "MediaManager.h";
#implementation BabyLearnViewController
#synthesize btnImage;
#synthesize myMediaManager;
I am getting the errors:
error: expected specifier-qualifier-list before 'MediaManager'
error: no declaration of property 'myMediaManager' found in the interface
Any ideas? Usually the 1st error comes up if you have a cylical reference. 'MediaManager' doesn't reference anything else. Any ideas?
Since you have no mentions of MediaManager class at the moment it is used in header file compiler can't figure out what "MediaManager" is and issues an error. Declare that class using forward declaration in your header file to let compiler know that MediaManager is actually a class:
#class MediaManager;
#interface BabyLearnViewController : UIViewController {
...
P.S. As an alternative you can import MediaManager.h in your header, but using forward declaration is preferred.
Place #import "MediaManager.h"
this in header file of BabyLearnViewController
try add #class MediaManager; before #interface

class declaration Problem in IPhone SDk?

i have declared one class such as
#import "CalcEntryVC.h"
#interface initialcontroller : UIViewController<UINavigationControllerDelegate>
{
IBOutlet BookmarkListTVC *bkcontroller;
IBOutlet CalcEntryVC *calcentryVCController;
}
but when i declare in BookmarkListTVC.h
as
#interface BookmarkListTVC : UITableViewController <UIActionSheetDelegate,UINavigationBarDelegate>
{
IBOutlet CalcEntryVC *calcentryVCController;
}
the error comes error: expected specifier-qualifier-list before 'CalcEntryVC'
how can i overcome , i tried #ifndef also.....any solution pls?
you don't want to import the header as suggested in another answer. YOu want to use the #class directive to declare CalcEntry as a forward declaration:
#class CalcEntryVC.h
Have you done #import "CalcEntryVC.h" in BookmarkListTVC.h?