i have a search view controller like below.
#interface SearchViewController : {
TopicRulesViewController *TViewController;
}
i want to move to another view.but i am getting this "error: expected specifier-qualifier-list before 'TopicRulesViewController'"
what is that error?
thanks in advance
You are missing a superclass after the :
You need to import header where TopicRulesViewController class is declared, or, even better - use forward declaration in header file and import necessary header in implementation file:
//header
#class TopicRulesViewController;
#interface SearchViewController : UIViewController{
TopicRulesViewController *TViewController;
}
//m-file
#import "TopicRulesViewController.h"
...
P.S. You also miss superclass for SearchViewController class, but that produces different compiler error so I assumed that that was just a typo...
Related
Im researching for this a while now, but i cant figure it out.
#theme: 'example';
// works
#import (reference) "../themes/#{theme}";
.import(#theme) {
// doesn't work
#import (reference) "../themes/#{theme}";
}
i guess the mixins get called at the "end" of the compiling process, so it cant import there because it needs the variables earlier.
is there some known hidden secret workaround for this?
this code
.import(#theme) {
// doesn't work
#import (reference) "../themes/#{theme}";
}
.import(hello);
failed because of
SyntaxError: variable #theme is undefined in less/capsule.less on line 33,
I have imported my .h file into a 2nd one, but in the 2nd one i'm trying to do:
FirstClass *firstClass = [FirstClass alloc] init];
[firstClass iconWithType:test];
To match this:
-(void)iconWithType:(NSString *)iconType
But it's not listing iconWithType as a suggestion and i get a warning saying it might not respond to that.
How can i get this to work properly?
My FirstClass is a UIView.
In your FirstClass.h file do you have the method definition in the interface?
I.e.
#interface FirstClass : NSObject {
}
- (void)iconWithType:(NSString *)iconType;
#end
Additionally, the name of the method implies something should be returned. However, it is marked as void.
I'm guessing you just have a return type mismatch. Take a look: does -iconWithType: actually return void? or does it return a UIImage or something else besides?
This interface is giving the errors:
#interface VideoFeedCollector : NSObject{
#public
NSData * received_data;
int feed_id;
BOOL transmitting;
}
THank you.
No #end with one of the interface declarations.
Either a circular #import or a syntax error in the .m file that imports this header or a syntax error in one of the headers.
I've got a simple question.
In Objective-C, when you have a method you want to call, with a return type of void, how you you call it from another method?
The way I've been doing it in my application is this:
[self nameOfMethod];
But that causes Xcode to spit out the following error:
Method '-nameOfMethod' not found (return type defaults to 'id')
Though it seems to still be executing.
Am I calling it right, or is there a better way?
Thanks!
I’m guessing you haven’t declared -nameOfMethod in the class interface and you’re calling it from another method whose implementation precedes the implementation of -nameOfMethod, i.e.:
- (void)someMethod {
[self nameOfMethod];
}
- (void)nameOfMethod {
// …
}
When the compiler is parsing -someMethod and -nameOfMethod hasn’t been declared in the class interface, it generates a warning because it doesn’t know about -nameOfMethod yet.
There are essentially two solutions for this. You could reorder the implementation file so that -nameOfMethod appears before -someMethod, but that’s not always possible. A better solution is to declare -nameOfMethod in the class interface. If -nameOfMethod is supposed to be called by clients of your class, place it in the corresponding header file. On the other hand, if -nameOfMethod is only supposed to be called inside your implementation file, use a class extension. Supposing your class is named SomeClass, this is what your header and implementation files would look like:
// SomeClass.h
#interface SomeClass : NSObject {
// … instance variables
}
// … external methods
- (void)someMethod;
#end
// SomeClass.m
#import "SomeClass.h"
#interface SomeClass () // this is a class extension
// … internal methods
- (void)nameOfMethod;
#end
#implementation SomeClass
- (void)someMethod {
[self nameOfMethod];
}
- (void)nameOfMethod {
// …
}
#end
Using class extensions, the order of method implementations won’t matter.
You need to make sure that your interface file contains a definition for nameOfMethod - so;
-(void) nameOfMethod;
You're calling it correctly, but make sure that the interface for your (void) method is in your .h file.
I get an 'Accessing unknown 'view' component of a property' error, when I'm trying this:
if (self.newsViewController.view.superview == nil)
I have a synthesize and an import for NewsViewController. What I'm doing wrong?
Unfortunately, SO won't let me comment on your post, but if that:
#interface newsViewController : UIViewController {
is actually copy & pasted, it might just be a typo (lowercase 'n' instead of uppercase in NewsViewController)?
Another problem might be absence of import...
http://shirishranjit.com/blog1/?p=132