2013-02-20 58 views
4

我正在爲警報提示創建一個trigger.io插件。 嘗試從警報提示中返回數據。 這是我的代碼:Trigger.io從插件返回數據的iOS插件

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

} 

以上爲不工作,我當我嘗試做[任務成功:無]。並且包括任務:(ForgeTask *)任務回撥停止工作。

但是不在[任務成功:無]; & 任務:(ForgeTask *)任務 NSLog確實有效。

我該如何解決這個問題?

+0

你怎麼稱呼這從javascript – 2013-12-18 06:58:00

+0

@ V-Xtreme Trigger.io已經創建了自己的通知插件請參閱 - https://trigger.io/modules/notification/current/docs/index.html – 2013-12-18 12:32:33

回答

0

所以你試圖返回[promptTextBox text]到調用JavaScript?

如何:

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

...還是我錯過了點?

+0

你怎麼稱呼這來自JavaScript – 2013-12-18 06:57:20