• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Whats Wrong?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Whats Wrong? (From: Luke Sands <email@hidden>)

  • Prev by Date: NSURL Tutorial?
  • Next by Date: Re: NSURL Tutorial?
  • Previous by thread: Whats Wrong?
  • Next by thread: NSURL Tutorial?
  • Index(es):
    • Date
    • Thread