Командное приложение Theos iPhone Shell

Я использую theos для создания приложения для iOS, которое устанавливает theos для тех, кто не знает, как это сделать.

Вот мой код:

#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

Я продолжаю получать эту ошибку, когда я иду, чтобы сделать пакет:

******-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

Может ли кто-нибудь помочь мне исправить это?


person D3ATH    schedule 28.06.2014    source источник


Ответы (1)


У тебя две опечатки.

1.

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

Вместо точки должно стоять двоеточие. Я думаю, вам нужно полностью удалить строку, а не просто исправить ее, потому что у вас есть точно такая же строка (но без опечатки) позже в коде.

2.

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

Неправильный случай. Должно быть @selector, а не @Selector

person creker    schedule 28.06.2014
comment
Если бы я хотел добавить к этому индикатор выполнения, например, экран уведомлений с ходом загрузки, как бы я это сделал? - person D3ATH; 28.06.2014
comment
Это сработало, потому что я удалил [self.view addSubview:installButton], который находится под @selector - person D3ATH; 29.06.2014