Amazon.com Widgets 16.6 problem
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 18, 2014, 06:06:59 AM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Old Stuff
| |-+  Chapter Study
| | |-+  Chapter 16 - Working with Files
| | | |-+  16.6 problem
Pages: [1]   Go Down
Print
Author Topic: 16.6 problem  (Read 3467 times)
djeans
Newbie
*
Posts: 9


Email




« on: October 09, 2009, 04:48:52 AM »

I can't seem to get this program to run. I get two errors, 'removeFileAtPath:handler' is deprecated, and 'copyPath:toPath:handler' is deprecated.

It builds and runs, but exits with a status value of 1, which means that there must be something going wrong around here
Code: (Objective-C)
	//Check for two arguments on the command line
if ([args count] != 3) {
NSLog (@"Usage: %@ src dest", [proc processName]);
return 1;
}

But I can't figure out what.

Any ideas?

Thanks

Darron
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







« Reply #1 on: October 09, 2009, 05:29:10 AM »

Darron,

Are you running this from a Terminal window and typing in two files names?
 
The program will still run, even with the deprecated methods.  

You can replace this line from Program 16.6

Code: (Objective-C)
[fm removeFileAtPath: dest handler: nil];

with this line

Code: (Objective-C)
[fm removeItemAtPath: dest error: nil];

and replace this line from Program 16.6

Code: (Objective-C)
if ([fm copyPath: source toPath: dest handler: nil] == NO) {

with this one

Code: (Objective-C)
if ([fm copyItemAtPath: source toPath: dest error: nil] == NO) {

you will then use the recommended methods in place of the two deprecated ones.  I will make sure to remove these deprecated methods from the next edition of the text.

Cheers,

Steve Kochan
« Last Edit: October 09, 2009, 05:48:39 AM by skochan » Logged
djeans
Newbie
*
Posts: 9


Email




« Reply #2 on: October 09, 2009, 05:59:19 AM »

Thanks for the reply Smiley

I am not running it from the terminal, I'm running it from XCode.

I replaced the lines you suggested, and now there are no warnings about deprecated functions, but it still does not run like it should.

this is the error that is returned

run
2009-10-09 02:57:19.063 Ch 16 Excercises[57878:a0f] Usage: Ch 16 Excercises src dest
[Switching to process 57878]
Running…

Debugger stopped.
Program exited with status value:1.The program being debugged is not being run.
The program being debugged is not being run.
(gdb)

Thanks

Darron
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







« Reply #3 on: October 09, 2009, 09:09:04 AM »

You need to run the program from inside Terminal as illustrated on Page 396.

Cheers,

Steve Kochan
Logged
Huiqi
Newbie
*
Posts: 8






« Reply #4 on: October 27, 2009, 10:01:16 AM »


I had problem to run 16.6 in Terminal. The message was 'copy command not found'. After debug & run of 16.6 in Xcode do I need to release 16.6 to the directory that I was working with UNIX command?

Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







« Reply #5 on: October 27, 2009, 12:40:54 PM »

I'm not sure what you mean by "release."   Make sure you're in the directory that the application is built in and try to run the command using ./copy (assuming your app is named copy) as noted in the text and in other posts in this forum on the topic.

Cheers,

Steve Kochan
Logged
Huiqi
Newbie
*
Posts: 8






« Reply #6 on: October 28, 2009, 04:31:44 AM »

Thanks Steve. I builded copy at Desktop. In this directory I did:
$ ls -l
drwxr-xr-x   7 huiqi  staff     238 28 Oct 11:01 copy
$ ./copy foo tmp
-bash: ./copy: is a directory
$ ls -l
drwxr-xr-x   7 huiqi  staff     238 28 Oct 11:01 copy
$ copy foo tmp
-bash: copy: command not found

Did I do something wrong?
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







« Reply #7 on: October 28, 2009, 05:35:19 PM »

copy is the name of your project, so that's the name Xcode gives to the folder that contains all your project files.  You have to navigate down to where the app is stored, also under the name copy.  Look inside the Build/Debug subfolder.

Cheers,

Steve Kochan
Logged
Huiqi
Newbie
*
Posts: 8






« Reply #8 on: October 29, 2009, 11:07:14 AM »

Thanks a lot Steve. I got it.
Logged
dinarose
Newbie
*
Posts: 4


Email




« Reply #9 on: August 26, 2010, 10:49:54 AM »

Hi Steve or Objective C geeks Wink
I am trying to implement 16.6 and it compile but not  run
here is the message
there was a year ago same question and below the reply is you need to run the program inside terminal.
my question is what do u mean by "inside Terminal"Huh

You need to run the program from inside Terminal as illustrated on Page 396.

Cheers,

Steve Kochan
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







« Reply #10 on: August 28, 2010, 09:20:43 PM »

In your Applications/Utilities folder is an app called Terminal.   That's the program you want to run.


Cheers,

Steve
Logged
modadrody
Newbie
*
Posts: 2

[url=http://whois.my-addr.com]whoislookup[/url]

255428123 romanbuttolez@gmail.com




« Reply #11 on: October 15, 2011, 05:24:23 PM »

Im having the exact same problem with revCopyFile on OS/X.  Works in IDE but gives an error when running stand alone.  Any ideas?
Logged

Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.