发送委托的MFMessageComposeViewController短信(MFMessageComposeViewController sms sent delegate)

我在我的应用程序MFMessageComposeViewController中实现了发送短信。 它运作良好,但我不知道是否可以知道消息实际发送的时间。

-(void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients {

    MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];

    if([MFMessageComposeViewController canSendText]) {

      controller.body = bodyOfMessage;    
      controller.recipients = recipients;
      controller.messageComposeDelegate = self;
      [self presentModalViewController:controller animated:YES];

    }
}

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {

  [self dismissModalViewControllerAnimated:YES];

  if (result == MessageComposeResultCancelled) {

    NSLog(@"Message cancelled");

  } else if (result == MessageComposeResultSent) {

    NSLog(@"Message sent");
  }

}

if(result == MessageComposeResultSent)仅对应于“发送”按钮,但如果消息已发送,则不会发出警告。 你知道是否有某种方式委派或知道短信是否被发送?

非常感谢!


I implemented in my app MFMessageComposeViewController for send sms. It works well, but I do not know if it is possible to know when the message is actually sent.

-(void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients {

    MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];

    if([MFMessageComposeViewController canSendText]) {

      controller.body = bodyOfMessage;    
      controller.recipients = recipients;
      controller.messageComposeDelegate = self;
      [self presentModalViewController:controller animated:YES];

    }
}

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {

  [self dismissModalViewControllerAnimated:YES];

  if (result == MessageComposeResultCancelled) {

    NSLog(@"Message cancelled");

  } else if (result == MessageComposeResultSent) {

    NSLog(@"Message sent");
  }

}

if (result == MessageComposeResultSent) corresponds only to the button "send" but not really a warning if the message has been sent. Do you know if there is some way to delegate or know if the SMS was sent or not?

Thanks a lot!


原文:https://stackoverflow.com/questions/8778444
2020-07-04 12:07

满意答案

我明白了,它应该是

PARAMS [:hds_persona]

在我的create-method中。

谢谢!


I got it, it should be

params[:hds_persona]

in my create-method.

Thank you!

相关问答

更多

Angular:将参数从$ routeProvider传递给控制器(Angular: Passing params from $routeProvider to controller)

路由: $routeProvider. when('/a', { templateUrl: 'test.html', controller: 'MyController', paramExample: 'exampleA' }). when('/b', { templateUrl: 'test.html', controller: 'MyController', paramExample: 'exampleB' }); 访问:在你的控制...

表格数据是通过会话还是参数传递的?(Is form data passed through session or params?)

要尝试在此测验的上下文中而不是仅仅在代码的上下文中回答您的问题,请考虑它的含义: params存在于表单的url或post体中,因此在查询完成后它就会消失。 现在考虑问题本身说: 用户提交新的电影表单 。 相关控制器如何访问电影的标题? 所以问题是用户通过填写表格进行交互,然后将表格post到服务器。 这正是笔记中提到的“表格的帖子” 。 所以正确答案是3) params['title'] 。 现在,一旦访问了这些数据,就可以将它放入会话中,但这是开发人员要做或决定的,而这并不是在这里所讨论的范围...

Angularjs:将对象传递给状态(Angularjs: passing an object params to state)

您在URL中传递的参数始终是字符串。 您可以传递多个字符串并将它们再次组合到一个对象。 .state('options', { url: "/options?current_task_1&current_task2", views: { "middle": { templateUrl: "/games/options.html" } } The parameter you pass in the URL is always a string. Yo...

如何将单个对象[]传递给params对象[](How to pass a single object[] to a params object[])

一个简单的typecast将确保编译器知道您在这种情况下的意思。 Foo((object)new object[]{ (object)"1", (object)"2" })); 作为一个数组是一个子类型的对象,这一切都奏效了。 一点奇怪的解决方案,但我会同意。 A simple typecast will ensure the compiler knows what you mean in this case. Foo((object)new object[]{ (object)"1", (ob...

订阅activatedRoute,params具有不同的属性来保存传递的参数值(subscribing to activatedRoute, params has different attributes to hold the param value passed)

我假设你正在沿着Angular的RouterModule使用一些东西? 我能想到的一件事是,其中的一些代码是重复的,并且一些路线有迂回的方式到达目的地。 例如,你可能会看到类似这样的代码: const routes: Routes = [ { path: 'target/:name', component: TargetComponent, canActivate: [AuthGuard]}, { path: 'target/:target', component: Tar...

比较params对象数组(Compare params array of objects)

如果您对适用于2个对象的逻辑可以,那么为什么不用相同的方式将所有对象与循环进行比较? public static bool Compare(bool compareTypes = false, params object[] values) { if (!compareTypes) { if (values == null || values.Length == 0) { return false; } ...

如何在Javascript中读取从C#传递的params object []项?(How to read params object[] items passed from C# in Javascript?)

params变量只是传入的许多参数中的第一个。您可以使用以下语法访问其他参数: alert(this.arguments[0]); alert(this.arguments[1]); alert(this.arguments[2]); 如果你在一个变量中传递所有参数,它将是一个数组,所以使用: alert(params[0]); alert(params[1]); alert(params[2]); The params variable is just the first of many a...

Ember.js将params对象传递给linkTo或action helper(Ember.js pass params object to linkTo or action helper)

我认为代码示例将是最有帮助的,但是为了尝试回答您的问题,是的,您可以使用以下内容将对象传递给linkTo : {{#linkTo routename params}}Text for Link{{/linkTo}} 然后,对于与路由名称匹配的路由代码,您可以在定义序列化函数时将params作为参数,并使用它们构建URL以匹配路由器中定义的路由段: serialize: function(params) { // params.property1 and params.property...

没有传递给新行动的参数(Params not being passed to new action)

既然你试图传递你的chichi参数,你可以使用button_to ,它基本上创建一个空的表单(你可以传递params): <%= button_to I18n.t('views.courses.index.add_new'), new_admin_course_path, method: :get, params: { chichi: @provider.id } %> Since you're trying to pass your chichi parameter, you could us...

Params没有传递给对象?(Params dont get passed to the object?)

我明白了,它应该是 PARAMS [:hds_persona] 在我的create-method中。 谢谢! I got it, it should be params[:hds_persona] in my create-method. Thank you!

相关文章

更多

微信开发之移动手机WEB页面(HTML5)Javascript实现一键拨号及短信发送功能

在做一个微信的微网站中的一个便民服务电话功能的应用,用到移动web页面中列出的电话号码,点击需要实现调 ...

.NET 微信开放平台接口(接收短信、发送短信)

前两天做个项目用到了微信api功能。项目完成后经过整理封装如下微信操作类。 以下功能的实现需要开发者已 ...

.NET 微信开放平台接口(接收短信、发送短信)

前两天做个项目用到了微信api功能。项目完成后经过整理封装如下微信操作类。 以下功能的实现需要开发者已 ...

实现友盟分享

-(void)shareWork:(id)sender{ UIActionSheet *share ...

从iMessage到微信,QQ离线短信服务,米聊,易信

  把iMessage、米聊、QQ离线短信服务、微信、易信放到一下,毫无疑问大家能够看出他们的共同点, ...

微信流行,短信没落

“之前节日的时候都是通过短信或者QQ给亲人朋友送祝福,再加上平时联系需要,一个月就要发几百条短信,套餐 ...

Java 发送邮件

Java 发送邮件 使用Java应用程序发送E-mail十分简单,但是首先你应该在你的机器上安 ...

Kafka发送消费的路由

Producer发送消息到broker时,会根据Paritition机制选择将其存储到哪一个Parti ...

发送内容给微信

微信开发相关文档:http://open.weixin.qq.com/document/sdk/ios ...

基于android开发金山卫士备份短信视频教程-android项目实战

金山手机卫士是金山网络有限公司开发的一款免费手机安全软件。以手机安全为核心,提供有流量监控、恶意扣费拦 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本