I'm needing help with implementing NSFileManager into my app to do things like in my bash scripts below.
hidemyx code:
showmyx code:
I've been told to use NSFileManager instead of system().
Here is my app code itself:
This is the log coming from the app with the way I have it programed now
hidemyx code:
Code:
#!/bin/bash
mv -f "/Applications/IntelliScreenX.app/Info.plist" "/Applications/HideMyX.app/show/"
cp -f "/Applications/HideMyX.app/hide/Info.plist" "/Applications/IntelliScreenX.app/"
showmyx code:
Code:
#!/bin/bash
rm -f /Applications/IntelliScreenX.app/Info.plist
mv -f "/Applications/HideMyX.app/show/Info.plist" "/Applications/IntelliScreenX.app/"
I've been told to use NSFileManager instead of system().
Here is my app code itself:
Code:
#import "RootViewController.h"
#import <UIKit/UIKit.h>
@implementation RootViewController
- (void)viewDidLoad {
self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background"]];
UIButton *hideButton = [[UIButton alloc] init];
hideButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
hideButton.frame = CGRectMake(10, 100, 90, 40);
[hideButton setTitle:@"Hide Icon" forState:UIControlStateNormal];
[hideButton setBackgroundImage:[UIImage imageNamed:@"hide.png"]
forState:UIControlStateNormal];
[hideButton addTarget:self action:@selector(hideButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:hideButton];
UIButton *showButton = [[UIButton alloc] init];
showButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
showButton.frame = CGRectMake(115, 100, 90, 40);
[showButton setTitle:@"Show Icon" forState:UIControlStateNormal];
[showButton setBackgroundImage:[UIImage imageNamed:@"show.png"]
forState:UIControlStateNormal];
[showButton addTarget:self action:@selector(showButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:showButton];
UILabel *supportLabel = [[UILabel alloc] initWithFrame:CGRectMake(21, 200, self.view.frame.size.width - 20, 44)];
supportLabel.text = @"Visit deathscreations.22web.org for support make sure to create your topic in the right area";
supportLabel.backgroundColor = [UIColor clearColor];
supportLabel.textColor = [UIColor greenColor];
supportLabel.textAlignment = UITextAlignmentLeft;
supportLabel.lineBreakMode = NSLineBreakByWordWrapping;
supportLabel.numberOfLines = 10;
[self.view addSubview:supportLabel];
[supportLabel release];
UILabel *respringLabel = [[UILabel alloc] initWithFrame:CGRectMake(21, 350, self.view.frame.size.width - 20, 44)];
respringLabel.text = @"Device will Respring when finished";
respringLabel.backgroundColor = [UIColor clearColor];
respringLabel.textColor = [UIColor greenColor];
respringLabel.textAlignment = UITextAlignmentLeft;
[self.view addSubview:respringLabel];
[respringLabel release];
}
-(void)hideButtonPressed
{
system("/usr/bin/hidemyx");
}
-(void)showButtonPressed
{
system("/usr/bin/showmyx");
}
@end
This is the log coming from the app with the way I have it programed now
Last edited: