Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6346555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:02:24+00:00 2026-05-24T21:02:24+00:00

Im trying to list the details of specific processes using a UITableView. It displays

  • 0

Im trying to list the details of specific processes using a UITableView. It displays perfectly when run on the Xcode simulator. However, it is malformed when deployed on the actual device. Perplexing thing is, when I perform the “ps aux” command on both the Mac and the iPhone, formatting of the outputs seem identical.

This is how it looks like in the simulator :

enter image description here

This is how it looks like on the real device :

enter image description here

Here is my code for the controller displaying these views :

viewDidLoad :

NSLog(@"myString is :%@", myString);
int processID = [myString intValue];

NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/bin/ps"];

arguments = [NSArray arrayWithObjects: @"aux", [NSString stringWithFormat:@"%i", processID],nil];

[task setArguments: arguments];

NSPipe *pipe;
pipe = [NSPipe pipe];
//[task setStandardOutput: pipe];
[task setStandardOutput:pipe];

NSFileHandle *file;
file = [pipe fileHandleForReading];

[task launch];

NSData *data;
data = [file readDataToEndOfFile];

NSString *string;
string = [[NSString alloc] initWithData: data
                               encoding: NSUTF8StringEncoding];

//  NSLog(@"%@",string);


NSArray *lines= [string componentsSeparatedByString:@"\n"];

NSString *lastline = [lines objectAtIndex:[lines count]-2];
//  NSLog(@"%@",lastline);




lines2= [lastline componentsSeparatedByString:@" "];
NSLog(@"%@",lines2);
for (int i=0; i<[lines2 count]; i++) {

    if([[lines2 objectAtIndex:i] isEqualToString:@""]){
        [lines2 removeObjectAtIndex:i];
    }

}
for (int i=0; i<[lines2 count]; i++) {

    if([[lines2 objectAtIndex:i] isEqualToString:@""]){
        [lines2 removeObjectAtIndex:i];
    }

}


NSLog(@"Lines 2 is%@",lines2);
NSLog(@"Status is %@",[lines2 objectAtIndex:7]);


self.title = @"Process Info";

label = [[NSMutableArray alloc]init];

[label addObject:@"User:"];
[label addObject:@"Process ID:"];
[label addObject:@"CPU(%):"];
[label addObject:@"MEM(%):"];
[label addObject:@"VSZ:"];
[label addObject:@"RSS:"];
[label addObject:@"TT:"];
[label addObject:@"STAT:"];
[label addObject:@"Time Started:"];
[label addObject:@"Time Elapsed:"];
[label addObject:@"Launch Command:"];

[super viewDidLoad];

cellForRowAtIndexPath:

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

[cell setSelectionStyle:UITableViewCellSelectionStyleNone]; 
NSString *cellValue = [label objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
cell.textColor = [UIColor colorWithRed:154.0/255.0 green:14.0/255.0 blue:2.0/255.0 alpha:1];
cell.font = [UIFont systemFontOfSize:16.0];


UILabel *label2 =  [[[UILabel alloc] initWithFrame:CGRectMake(120.0, 0, 240.0, 
                                                              tableView.rowHeight)] autorelease]; 


label2.font = [UIFont systemFontOfSize:16.0]; 
NSString *cellValue1 = [lines2 objectAtIndex:indexPath.row];
label2.text = cellValue1;
label2.textAlignment = UITextAlignmentLeft; 
label2.textColor = [UIColor blackColor]; 
label2.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | 
UIViewAutoresizingFlexibleHeight; 
[cell.contentView addSubview:label2]; 


return cell;

numberOfRowsInSection:

return [label count];

dealloc:

 [myString release];
[arguments release];
//[lines2 release];
[ResultStringID release];
[values release];
[label release];
[super dealloc];

The output of “ps aux” command on Mac :

enter image description here

The output of “ps aux” command on iPhone (Through an SSH shell) :

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:02:25+00:00Added an answer on May 24, 2026 at 9:02 pm

    There’s no guarantee that ps on iOS does the same thing as on other platforms. There’s no UI that would allow a user to access the ps command on iOS devices, so you’re lucky that there’s a ps command at all. Try logging the output from the command to see what you’re getting, but don’t be surprised if there’s not much there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to list all categories in a VPP-folder using a module from Meridium
I am trying to list all the controllers and their actions with specific attributes
I'm trying to access list data using SSRS 2008. I have created an XML
I am trying to call GetUserInfo on a sharepoint list (using the sharepoint web
Im trying to do bind a dropdown list to a details view but keep
I am trying to get the drop down list of combobox by using a
I'm trying to list available interfaces using the WSAIoctl function. I have to pass
I'm trying to get details of Foursquare list by PHP library : $foursquare =
I am trying to list last visits per hour in last 24 hours. I
I am trying to list last a website's statistics. I listed Last 30 days

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.