gpt4 book ai didi

objective-c - [Obj-C]我如何在使用 NSTask 后做一个 IBAlert?

转载 作者:行者123 更新时间:2023-11-28 23:18:18 24 4
gpt4 key购买 nike

我使用 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.

关于objective-c - [Obj-C]我如何在使用 NSTask 后做一个 IBAlert?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4771348/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com