iOS 6 – ChatKit私有API – 发送短信

iOS 6 – ChatKit私有API – 发送短信,第1张

概述有没有人设法在iOS 6中没有用户交互的情况下从代码发送短信? 我认为,必须使用ChatKit私有API来执行此 *** 作.但是,似乎Apple在iOS 6中对此API进行了相当多的更改.因此,由于缺少/更改了类,因此https://stackoverflow.com/a/11028230/1884907之类的解决方案在iOS 6上不再起作用. (只是提前:是的,我们都知道Apple拒绝使用私有API的 有没有人设法在iOS 6中没有用户交互的情况下从代码发送短信?

我认为,必须使用ChatKit私有API来执行此 *** 作.但是,似乎Apple在iOS 6中对此API进行了相当多的更改.因此,由于缺少/更改了类,因此https://stackoverflow.com/a/11028230/1884907之类的解决方案在iOS 6上不再起作用.

(只是提前:是的,我们都知道Apple拒绝使用私有API的应用程序,它不适用于应用程序商店)

解决方法 来自另一个StackOverflow帖子 here :(来自Kaushal Bisht的代码)

// in .m file-(voID)textClicked{ controller = [[MFMessageComposeVIEwController alloc] init]; if([MFMessageComposeVIEwController canSendText])    {       controller.body = @"Whatever you want";   controller.recipIEnts = [NSArray arrayWithObjects:@"",nil];       controller.messageComposeDelegate = self;       [self presentVIEwController:controller animated:YES completion:nil];      }   }  - (voID)messageComposeVIEwController:(MFMessageComposeVIEwController *)controller dIDFinishWithResult:(MessageComposeResult)result  {  UIAlertVIEw *alert = [[UIAlertVIEw alloc] initWithTitle:@"MyApp" message:@"UnkNown Error"                                               delegate:self cancelbuttonTitle:@"OK" otherbuttonTitles: nil];switch (result) {    case MessageComposeResultCancelled:        NSLog(@"Cancelled");        [alert show];        break;    case MessageComposeResultFailed:        [alert show];        break;    case MessageComposeResultSent:        break;    default:        break;  }[self dismissVIEwControllerAnimated:YES completion:nil];    }// in .h file import MessageUI/MessageUI.h

但是,您无法在后台发送短信.我希望这有帮助.

总结

以上是内存溢出为你收集整理的iOS 6 – ChatKit私有API – 发送短信全部内容,希望文章能够帮你解决iOS 6 – ChatKit私有API – 发送短信所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1019834.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存