将作曲家文本框值添加到数组中?

发布于 2024-10-16 07:33:39 字数 665 浏览 2 评论 0原文

  1. 我有 coredata 在文本字段中显示存储的数据

    视图中didload: tfEmail.text = editEmp.email;
    
  2. 消息编辑器也可以工作,但是如果我想使用电子邮件数据包含在我的消息中,我就会遇到麻烦。 .

    NSArray *toRecipients = [NSArray arrayWithObject:@"[电子邮件受保护] "];
    [选择器 setToRecipients:toRecipients];
    
  3. 我需要做的是包含 tfEmail在 NSArray 中,所以如果我尝试

    NSArray *toRecipients = [NSArray arrayWithObject:@"%@", tfEmail.text];
    

    我会收到一个错误

    函数 arrayWithObject 的参数过多
    

如何解决这个问题?

  1. I have the coredata showing in text fields the data stored

    in view didload: tfEmail.text = editEmp.email;
    
  2. the message composer works as well, but if I want to use the email data to include in my message, I get the trouble...

    NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"];
    [picker setToRecipients:toRecipients];
    
  3. what I need to do is to include the tfEmail in the NSArray, so if I try

    NSArray *toRecipients = [NSArray arrayWithObject:@"%@", tfEmail.text];
    

    I will get an error

    Too many arguments to function arrayWithObject
    

How do I fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

给我一枪 2024-10-23 07:33:39

您尝试将字符串传递给数组初始值设定项,但实际上传递了两个 字符串。应更改此行:

 NSArray *toRecipients = [NSArray arrayWithObject:@"%@", tfEmail.text];

您正在传递两个字符串对象,@"%@"tfEmail.text。尝试删除格式字符串,如下所示:

NSArray *toRecipients = [NSArray arrayWithObject:tfEmail.text];

如果您想保留格式,请按如下方式包装这些字符串:

NSArray *toRecipients = [NSArray arrayWithObject:[NSString stringWithFormat:@"%@", tfEmail.text]];

You are tryig to pass a string to the array initializer but are actually passing in two strings. This line should be changed:

 NSArray *toRecipients = [NSArray arrayWithObject:@"%@", tfEmail.text];

You are passing in two string objects, @"%@" and tfEmail.text. Try removing the format string, like so:

NSArray *toRecipients = [NSArray arrayWithObject:tfEmail.text];

If you wanted to keep the format, wrap those strings as follows:

NSArray *toRecipients = [NSArray arrayWithObject:[NSString stringWithFormat:@"%@", tfEmail.text]];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文