Undeclared - 'first use in function'
Posted
by
Ragunath Jawahar
on Stack Overflow
See other posts from Stack Overflow
or by Ragunath Jawahar
Published on 2011-06-21T08:15:29Z
Indexed on
2011/06/21
8:22 UTC
Read the original article
Hit count: 173
I'm new to Objective-C, though I have a very good hand in Android. I'm trying to make a call to a method but it gives me 'first use in function'. I know I'm making a silly mistake but experts could figure it out easily.
RootViewController.h
#import <UIKit/UIKit.h>
#import "ContentViewController.h"
@interface RootViewController : UITableViewController {
ContentViewController *contentViewController;
}
@property (nonatomic, retain) ContentViewController *contentViewController;
- (NSString*)getContentFileName:(NSString*)title; //<--- This function declartion
@end
RootViewController.m
#import "RootViewController.h"
#import "HAWATAppDelegate.h"
#import "ContentViewController.h"
@implementation RootViewController
@synthesize contentViewController;
...
more methods
...
#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
HAWATAppDelegate *appDelegate = (HAWATAppDelegate *)[[UIApplication sharedApplication] delegate];
NSString *title = (NSString *) [appDelegate.titles objectAtIndex:indexPath.row];
NSString *fileName = getContentFileName:title; //<--- Here is the error
...
}
- (NSString*) getContentFileName:(NSString*)title {
return [title lowercaseString];
}
@end
There must be a simple thing I'm missing. Please let me know. Thanks in advance.
© Stack Overflow or respective owner