Kobold2d and XCode 4.6 Error - kobold2d

I had the same issue as gabrielhilal as see here. LearnCocos2D posted to remove all references to FIXCATEGORYBUG. My question is how to do this? References from where? My apologies if that is a silly question.

The following files in Kobold2d have to be changed:
FixCategoryBug.h line 15:
from:
#define FIX_CATEGORY_BUG(name) #interface FIXCATEGORYBUG ## name; #end #implementation FIXCATEGORYBUG ## name; #end
to:
#define FIX_CATEGORY_BUG(name) #interface FIXCATEGORYBUG ## name : NSObject #end #implementation FIXCATEGORYBUG ## name #end
NSMutableArray+WeakReferences.m line 39:
from:
#define FIX_CATEGORY_BUG(name) #interface FIX_CATEGORY_BUG_##name #end #implementation FIX_CATEGORY_BUG_##name #end
to:
#define FIX_CATEGORY_BUG(name) #interface FIX_CATEGORY_BUG_##name : NSObject #end #implementation FIX_CATEGORY_BUG_##name #end

Ok this was a lame question. Sorry I'm new. On the off chance someone else sees this then just go to Edit > Find > Find in Workspace. Search for FIXCATEGORYBUG. I commented every #import statement and things worked ok after that.

Related

Cannot find protocol declaration for 'xxxxx'; Did you mean 'yyyyy'

I have multiple protocol in Xcode Project it will give error such like this. help me
Error Like :-> Cannot find Protocol declaration for 'ButtonDelegate' did you mean 'CustomDelegate'?
Thanks in Advance
Delegate Header File
#import <UIKit/UIKit.h>
#import "Constant.h"
#protocol ButtonDelegate <NSObject>
-(void)ChatButtonClicked;
#end
#interface DonttreadonmeCell : UITableViewCell<UIGestureRecognizerDelegate,UITextViewDelegate>{
id <ButtonDelegate> Buttondelegate;
.h File
#import <UIKit/UIKit.h>
#import <Twitter/Twitter.h>
#import "JSONParsing.h"
#import "Facebook.h"
#import "DonttreadonmeCell.h"
#import "Constant.h"
#class DonttreadonmeCell;
#interface BookTextPeregraphselectedViewController : UIViewController<MFMailComposeViewControllerDelegate,FBSessionDelegate,FBRequestDelegate,ButtonDelegate,FBLoginDialogDelegate,FBDialogDelegate,JSONParsingDelegate,UITableViewDataSource,UITableViewDelegate,UIGestureRecognizerDelegate,UITextViewDelegate>{
I declared my protocol declaration section in top of the import file... it worked thank God.
#protocol ButtonDelegate <NSObject>
-(void)ChatButtonClicked;
#end
#import <UIKit/UIKit.h>
#import "Constant.h"
Like this
Include header file related to particular missing protocol.
In my case it was MFMailComposeViewControllerDelegate. I added
#import <MessageUI/MessageUI.h>
Problem fixed.
These 2 imports solved my problem. Please try it.
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>

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.

Unknown type name Error 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

Cannot find protocol declaration for

I have two objects, both of which are view controllers. The first (Ill call it viewController1) declares a protocol. The second (which unsurprisingly I will name viewController2) conforms to this protocol.
XCode is giving me a build error of: 'Cannot find protocol declaration for viewController1'
I have seen various questions on this subject and I am certain it is to do with a loop error, but I just can't see it in my case...
Code below..
viewController1.h
#protocol viewController1Delegate;
#import "viewController2.h"
#interface viewController1 {
}
#end
#protocol viewController1Delegate <NSObject>
// Some methods
#end
viewController2.h
#import "viewController1.h"
#interface viewController2 <viewController1Delegate> {
}
#end
Initially, I had the import line in viewController1 above that of the protocol declaration. This was preventing the project from building at all. After searching on SO, I realised the problem and switched the two lines around. I am now getting a warning (as opposed to an error). The project builds fine and actually runs perfectly. But I still feel there must be something wrong to be given a warning.
Now, as far as I can see, when the compiler gets to viewController1.h, the first thing it sees is the declaration of the protocol. It then imports the viewController.h file and sees this implements this protocol.
If it were compiling them the other way around, it would look at viewController2.h first, and the first thing it would do is import viewController1.h the first line of which is the protocol declaration.
Am I missing something?
Remove this line from viewController1.h:
#import "viewController2.h"
The problem is that viewController2's interface is preprocessed before the protocol declaration.
The general structure of the file should be like this:
#protocol viewController1Delegate;
#class viewController2;
#interface viewController1
#end
#protocol viewController1Delegate <NSObject>
#end
A.h:
#import "B.h" // A
#class A;
#protocol Delegate_A
(method....)
#end
#interface ViewController : A
#property(nonatomic,strong)id<ViewControllerDelegate> preViewController_B;(protocol A)
#end
B.h:
#import "A.h" // A
#class B;
#protocol Delegate_B
(method....)
#end
#interface ViewController : B
#property(nonatomic,strong)id<ViewControllerDelegate> preViewController_A;(protocol B)
#end
A.m:
#interface A ()<preViewController_B>
#end
#implementation A
(implement protocol....)
end
B.m:
#interface B ()<preViewController_A>
#end
#implementation B
(implement protocol....)
#end
For those who might need it:
It's also possible to fix this by moving the importation of ViewController1.h in ViewController2's implementation file (.m) instead of the header file (.h).
Like so:
ViewController1.h
#import ViewController2.h
#interface ViewController1 : UIViewController <ViewController2Delegate>
#end
ViewController2.h
#protocol ViewController2Delegate;
#interface ViewController2
#end
ViewController2.m
#import ViewController2.h
#import ViewController1.h
#implementation ViewController2
#end
This will fix the case where the error happens because ViewController1.h is imported in ViewController2.h before the protocol declaration.

iPhone: Warning in Cyclic import in MKAnnotation: method not found

I just resolved a cyclic dependency problem by using class forwarding. Now, I am getting a warning of no 'showSumDetails' method found. I don't understand why it should happen at all, any help will be appreciated. Including a bit of code here:
MyAnnotation.h
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
//#import "MyMapViewController.h" obviously this wasn't possible :-(
#class MyMapViewController;
#interface MyAnnotation : NSObject<MKAnnotation> {
MyMapViewController* mapController;
}
MyMapViewController.h
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <MapKit/MKReverseGeocoder.h>
#import "MyAnnotation.h"
#interface MyMapViewController : UIViewController <MKMapViewDelegate>{
MyAnnotation *annot;
}
MyMapViewController.m - where the method actually exists, and it is defined in the header file as well.
#implementation MyMapViewController
#synthesize annot;
-(void) showSumDetails:(id)aSumData{
NSLog(#"mapViewController-showSumDetails");
SumDetailsViewController *wrController = [[SumDetailsViewController alloc] init];
wrController.sumData = aSumData;
[self.navigationController pushViewController:wrController animated:YES];//This needs to be pushed
[wrController release];
}
#end
But the following method in MyAnnotation.m can't find the method above :-(
#implementation MyAnnotation
#synthesize sumData;
#synthesize mapController;
- (void) showPD{//is also defined in header file
NSLog(#"sPD - MyAnn");
[mapController showSumDetails:sumData]; //This doesn't have a clue about showSumDetails method- Why??
}
I'd be glad to provide any more info. Please help!!!
Did you import MyMapViewController.h in MyAnnotation.m?
Since you're using a forward reference for MyMapViewController in MyAnnotation.h you need to import MyMapViewController.h in MyAnnotation.m.