MYHelloWorld.h: 7:1: error: stray '@' in program
MYHelloWorld.m: 5:1: error: stray '@' in program
# Import
@ Interface MYHelloWorld: NSObject {
NSString * _userName;
}
@ property (nonatomic, retain) NSString * userName;
- (Id) initWithUserName: (NSString *) userName;
- (Void) helloWorld;
@ End
# Import "MYHelloWorld.h"
@ Implementation MYHelloWorld
@ synthesize userName = _userName;
- (Id) initWithUserName: (NSString *) userName {
self = [super init];
_userName = [userName copy];
return self;
}
- (Void) helloWorld {
NSString * text = [NSString stringWithFormat: @ "% @, Hello World!", _userName];
printf ([text UTF8String]);
}
- (Void) dealloc {
[_userName Release];
[Super dealloc];
}
@ End
Reply:
e ... printf function of c iostd library to include it
Reply:
printf replaced NSLog
Reply:
No error.
Check spelling and punctuation in English is wrong.
Reply:
Try unified naming it. . ?
Reply:
# import "MYHelloWorld.h"
@ Implementation MYHelloWorld
@ Synthesize userName;
- (Id) initWithUserName: (NSString *) userName {
self = [super init];
_userName = [userName copy];
return self;
}
- (Void) helloWorld {
NSString * text = [NSString stringWithFormat: @ "% @, Hello World!", _userName];
printf ([text UTF8String]);
}
- (Void) dealloc {
[_userName Release];
[Super dealloc];
}
@ End
Reply:
_userName If not, do not release the alloc of it. . .
Reply:
@ Property (copy) NSString * userName;
Reply:
Look. . . . . .
No comments:
Post a Comment