Search code examples
iosiphoneshellcommandtheos

Theos iPhone Shell Command App


I'm using theos to make a app for iOS that installs theos for those that don't know how.

Here is my code:

#import "RootViewController.h"
#import <UIKit/UIKit.h>

@implementation RootViewController
- (void)loadView {
    self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
    self.view.backgroundColor = [UIColor blueColor];

    UIButton *installButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    installButton.frame = CGRectMake(21, 80, 100, 35);
    [installButton setTitle:@"Install Theos" forState:UIControlStateNormal];
    [self.view addSubview.installButton];
    [installButton addTarget:self action:@Selector(installButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:installButton];
}

-(void)installButtonPressed
{
system("apt-get update");
system("apt-get install perl net.howett.theos");
}
@end

I keep getting this error when I go to make the package:

******-macbook:theosinstaller D3Ath$ make package
/Users/D3Ath/theosinstaller/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for application TheosInstaller...
 Copying resource directories into the application wrapper...
 Compiling RootViewController.mm...
RootViewController.mm:12:26: error: expected ']'
    [self.view addSubview.installButton];
                         ^
RootViewController.mm:13:42: error: unexpected '@' in program
    [installButton addTarget:self action:@Selector(installButtonPressed...
                                         ^
2 errors generated.
make[2]: *** [obj/RootViewController.mm.756d20f8.o] Error 1
make[1]: *** [internal-application-all_] Error 2
make: *** [TheosInstaller.all.application.variables] Error 2

Can anyone help me fix it?


Solution

  • You've got two typos.

    1.

    [installButton setTitle:@"Install Theos" forState:UIControlStateNormal];
    ---> [self.view addSubview.installButton];
    [installButton addTarget:self action:@Selector(installButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:installButton];
    

    There should be a colon instead of a period. I think you need to remove the line completely instead of just fixing it because you have the same exact line (but without a typo) later in the code.

    2.

    ---> [installButton addTarget:self action:@Selector(installButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:installButton];
    

    Wrong case. It should be @selector, not @Selector