Re: Whats Wrong?
Re: Whats Wrong?
- Subject: Re: Whats Wrong?
- From: Finlay Dobbie <email@hidden>
- Date: Sun, 28 Oct 2001 19:43:53 +0000
On Sunday, October 28, 2001, at 07:23 pm, Luke Sands wrote:
- (IBAction)clicked:(id)sender
this is an incorrect method declaration. you need a { here before your
code.
NSString *source = @"/tmp/quarterly_report.rtf";
NSString *destination = [[NSHomeDirectory()
stringByAppendingPathComponent:@"Library"]
stringByAppendingPathComponent:@"Reports"];
NSFileManager *manager = [NSFileManager defaultManager];
if ([manager fileExistsAtPath:source])
[manager copyPath:source toPath:destination handler:nil];
at the end of your methods, you must have a }.
So, the correct code would be:
#import "MyCopyButton.h"
@implementation MyCopyButton
- (IBAction)clicked:(id)sender {
NSString *source = @"/tmp/quarterly_report.rtf";
NSString *destination = [[NSHomeDirectory()
stringByAppendingPathComponent:@"Library"]
stringByAppendingPathComponent:@"Reports"];
NSFileManager *manager = [NSFileManager defaultManager];
if ([manager fileExistsAtPath:source])
[manager copyPath:source toPath:destination handler:nil];
}
@end
-- Finlay