expecte ')' before className
Posted
by Akbarbuneri
on Stack Overflow
See other posts from Stack Overflow
or by Akbarbuneri
Published on 2010-05-20T10:15:22Z
Indexed on
2010/05/20
10:30 UTC
Read the original article
Hit count: 182
Hi
I have a class DataObject as
Header :::
#import <Foundation/Foundation.h>
@interface DataObject : NSObject {
NSString *erorrMessage;
BOOL hasError;
NSDictionary *dataValues;
}
@property(nonatomic, retain)NSString *erorrMessage;
@property(nonatomic)BOOL hasError;
@property(nonatomic, retain)NSDictionary *dataValues;
@end
Class Implementation::::
#import "DataObject.h"
@implementation DataObject
@synthesize erorrMessage;
@synthesize hasError;
@synthesize dataValues;
@end
And I have another class as DataManager
Header as ::::
#import <Foundation/Foundation.h>
@interface DataManager : NSObject
- (DataObject *)getData :(NSString*)url;
@end
Implementation ::::
#import "DataManager.h"
#import "DataObject.h"
#import "JSON.h"
@implementation DataManager
- (DataObject *)getData :(NSString*)url{
DataObject* dataObject = [[DataObject alloc]init];
NSString *urlString = [NSString stringWithFormat:url];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
//TODO: Here we have to check the internet connection before requesting.
NSError * erorrOnRequesting;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&erorrOnRequesting];
NSString* responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
if( erorrOnRequesting != nil)
{
dataObject.hasError = YES;
dataObject.erorrMessage = @"Error on requsting to the web server";
return dataObject;
}
NSError *errorOnParsing;
SBJSON *json = [[SBJSON new] autorelease];
NSDictionary *dataValues = [json objectWithString:responseString error:&errorOnParsing];
[responseString release];
if(errorOnParsing != nil)
{
//TODO: We have to send the website a feedback that there is some problem on the server end.
dataObject.hasError = YES;
dataObject.erorrMessage = @"Error on parsing, the server returned invalid data.";
return dataObject;
}
dataObject.hasError = NO;
dataObject.dataValues = dataValues;
return dataObject;
}
@end
Now when I build I got an error in the DataManager header where I #import Dataobject header, it says "error: expected')' before DataObject"
I don;t understand what I miss.
Thanks for the help..
© Stack Overflow or respective owner