Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Mac OS X Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-04-2010, 02:20 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 69
Default NSTask setArguments issue

hi guys the basic idea of what im trying to do is build a tiny lil app that uses scp to copy over an .app folder onto my device. theres probably apps already like this but for the sake of learning how, i want to make one lol

on my app i have 3 textfields
App Path - for the location on my comp
Remote IP - the iphones "root@ip" combo
Remote Location - the folder i want to copy the stuff over to

the argument line i use in junction with scp is:
Code:
[scp setArguments:[NSArray arrayWithObjects:@"-r", [appPath stringValue],
					 [phoneIp stringValue], [phonePath stringValue], nil]];
which if im doing it right should be
Code:
scp -r ~/myapp.app root@10.0.2.3:/Applications/
but its not doing it that way, it uploads to the phone.. i just dont know where..

also i want to include a respring and reboot option to, so i would need the phoneIP just be the bare root@ip without the colon

truehybridx is offline   Reply With Quote
Old 01-05-2010, 07:20 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: London
Posts: 226
Default

Quote:
Originally Posted by truehybridx View Post
Code:
[scp setArguments:[NSArray arrayWithObjects:@"-r", [appPath stringValue],
					 [phoneIp stringValue], [phonePath stringValue], nil]];
I think this is passing the IP and path as two separate arguments, separated by a space. Try combining them into a single param, eg.
Code:
[scp setArguments:[NSArray arrayWithObjects:@"-r", [appPath stringValue],
    [NSString stringWithFormat: @"%@%@", [phoneIp stringValue], [phonePath stringValue]],
    nil]];
__________________
SimCap - Simple iPhone and iPad Simulator screen capture
_sjc_ is offline   Reply With Quote
Old 01-05-2010, 09:45 PM   #3 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 69
Default

soo exactly what does %@%@ do?
THANKS by the way, it worked!!
truehybridx is offline   Reply With Quote
Old 01-06-2010, 07:43 AM   #4 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: London
Posts: 226
Default

Quote:
Originally Posted by truehybridx View Post
soo exactly what does %@%@ do?
%@ inserts the description of an object into a string. If you're familiar with printf() and similar, you'll recognise %i, %d, %s and so on. %@ is a Foundation-specific extension. In this case, you're inserting the description of a couple of NSString objects, where their description is just their string value. If the objects were NSNumbers this would insert their number values; if they were collections (NSArray, NSDicitionary, NSSet, etc,.) it would insert the description of every object they contain.
__________________
SimCap - Simple iPhone and iPad Simulator screen capture
_sjc_ is offline   Reply With Quote
Old 01-07-2010, 05:46 PM   #5 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 69
Default

ok im kinda understanding it lol

is there a NSString version of substring? id like to set my app to use only one local path field..

in example:
Code:
Path = /var/mobile/myapp.app/myapp

something that returns /var/mobile/myapp.app
with the subtraction of /myapp from the original path name
truehybridx is offline   Reply With Quote
Old 01-08-2010, 04:05 AM   #6 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: London
Posts: 226
Default

Yep, there are NSString methods for substring (eg. –substringWithRange:, -substringFromIndex: and –substringToIndex: ), but to do what you quoted you may want to look at -stringByDeletingLastPathComponent, which is one of the filepath-specific manipulation methods. Take a look at the NSString docs. It's a large class with lots and lots of functionality.
__________________
SimCap - Simple iPhone and iPad Simulator screen capture
_sjc_ is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 245
13 members and 232 guests
2WeeksToGo, ADY, BrianSlick, Dani77, Dattee, headkaze, kapps11, mer10, mgon987, sneaky, timle8n1, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,879
Threads: 89,228
Posts: 380,744
Top Poster: BrianSlick (7,129)
Welcome to our newest member, mgon987
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:44 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0