gpt4 book ai didi

ios - Trigger.io iOS 插件从回调返回数据

转载 作者:可可西里 更新时间:2023-11-01 06:16:05 25 4
gpt4 key购买 nike

我正在为警报提示创建一个 trigger.io 插件。尝试从警报提示返回数据。这是我的代码:

 // Prompt
+ (void)show_prompt:(ForgeTask*)task{
// Create the alert
UIAlertView *prompt = [[UIAlertView alloc] initWithTitle:@"Title"
message:@"Message"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:@"Cancel", nil];
UITextField *promptTextBox = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)];

[promptTextBox setTag:30050]; // set tag to find the text box
[promptTextBox setBackgroundColor:[UIColor whiteColor]];
[prompt addSubview:promptTextBox]; // add it to the alert
[prompt show]; //show alert

}

// Call back
+ (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex task:(ForgeTask*)task
{
// Grab the reply from text box
UITextField* promptTextBox = (UITextField*)[alertView viewWithTag:30050];
NSLog(@"%@", [promptTextBox text]); // output to log
[task success:nil]; // output call back

}

当我尝试执行 [task success:nil]; 并包括 task:(ForgeTask*)task 时,上面的方法不起作用,回调停止工作.

但是如果没有 [task success:nil]; & task:(ForgeTask*)task NSLog 确实可以工作。

我该如何解决这个问题?

最佳答案

所以您正在尝试将 [promptTextBox 文本] 返回给调用 JavaScript?

这个怎么样:

NSLog(@"%@", [promptTextBox text]); // output to log   
[task success:[promptTextBox text]]; // output call back

... 还是我没捕获要点?

关于ios - Trigger.io iOS 插件从回调返回数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14984023/

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