我使用NSTask,可以100%工作,但是在运行它之后(运行它时,我也使用MBProcessHUD)我想在其中做一些IBAlert ...

这是我的代码

-(void) runScript {
    task = [[NSTask alloc] init];
    [task setLaunchPath:@"/bin/bash"];
    NSString *script;
    script = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"a2cy.sh"];
    NSArray *arguments = [NSArray arrayWithObjects:script, [sourcerepo text], nil];
    [task setArguments: arguments];
    [task launch];
    sleep(1);
    HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkmark.png"]] autorelease];
    HUD.mode = MBProgressHUDModeCustomView;
    HUD.labelText = @"Complete!";
    NSString *loggy;
    loggy = [NSString stringWithContentsOfFile:[[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/log.txt"]];
    UIAlertView *log = [[UIAlertView alloc] initWithTitle:@"Result" message:loggy delegate:self cancelButtonTitle:@"Ok!" otherButtonTitles:nil];
    [loggy show];
    [loggy release];
}


但是运行后,它没有显示:/有帮助吗?谢谢

最佳答案

我没有仔细看一下,但是您正在将show发送到NSString loggy而不是UIAlert log

10-08 18:49