<tfoot id='NgzBK'></tfoot>
    1. <i id='NgzBK'><tr id='NgzBK'><dt id='NgzBK'><q id='NgzBK'><span id='NgzBK'><b id='NgzBK'><form id='NgzBK'><ins id='NgzBK'></ins><ul id='NgzBK'></ul><sub id='NgzBK'></sub></form><legend id='NgzBK'></legend><bdo id='NgzBK'><pre id='NgzBK'><center id='NgzBK'></center></pre></bdo></b><th id='NgzBK'></th></span></q></dt></tr></i><div id='NgzBK'><tfoot id='NgzBK'></tfoot><dl id='NgzBK'><fieldset id='NgzBK'></fieldset></dl></div>

      <small id='NgzBK'></small><noframes id='NgzBK'>

        <bdo id='NgzBK'></bdo><ul id='NgzBK'></ul>

      <legend id='NgzBK'><style id='NgzBK'><dir id='NgzBK'><q id='NgzBK'></q></dir></style></legend>

        MFMessageComposeViewController alloc 返回 nil

        MFMessageComposeViewController alloc returns nil(MFMessageComposeViewController alloc 返回 nil)
            <tbody id='pPvxw'></tbody>

              <small id='pPvxw'></small><noframes id='pPvxw'>

                <tfoot id='pPvxw'></tfoot>
                <legend id='pPvxw'><style id='pPvxw'><dir id='pPvxw'><q id='pPvxw'></q></dir></style></legend>
                • <bdo id='pPvxw'></bdo><ul id='pPvxw'></ul>

                  <i id='pPvxw'><tr id='pPvxw'><dt id='pPvxw'><q id='pPvxw'><span id='pPvxw'><b id='pPvxw'><form id='pPvxw'><ins id='pPvxw'></ins><ul id='pPvxw'></ul><sub id='pPvxw'></sub></form><legend id='pPvxw'></legend><bdo id='pPvxw'><pre id='pPvxw'><center id='pPvxw'></center></pre></bdo></b><th id='pPvxw'></th></span></q></dt></tr></i><div id='pPvxw'><tfoot id='pPvxw'></tfoot><dl id='pPvxw'><fieldset id='pPvxw'></fieldset></dl></div>
                  本文介绍了MFMessageComposeViewController alloc 返回 nil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我的应用程序中,MFMailComposeViewController 工作正常,但创建 MFMessageComposeViewController 的新实例失败.

                  In my application, MFMailComposeViewController works fine but creating a new instance of MFMessageComposeViewController fails.

                  这是两者的代码:

                  -( IBAction)sendSMS: (id)sender
                  {
                   MFMessageComposeViewController *picker = [[[MFMessageComposeViewController alloc] init] autorelease];
                   picker.messageComposeDelegate = self;
                  
                   NSArray *toRecipients = [NSArray arrayWithObject: cell.currentTitle ]; 
                  
                   picker.recipients = toRecipients;
                  
                   [self presentModalViewController:picker animated:YES];
                  }
                  
                  -( IBAction)sendEmail: (id)sender
                  {
                   MFMailComposeViewController *picker = [[[MFMailComposeViewController alloc] init] autorelease];
                   picker.mailComposeDelegate = self;
                  
                   NSArray *toRecipients = [NSArray arrayWithObject: email.currentTitle ]; 
                  
                   [picker setToRecipients:toRecipients];
                  
                   [self presentModalViewController:picker animated:YES];
                  }
                  

                  看起来一切都正确链接,因为电子邮件视图控制器工作正常.有什么我遗漏的东西可能是配置方面的吗?

                  Its seemingly obvious that everything is linking correctly because the email view controller works fine. Is there something I am missing maybe configuration wise?

                  推荐答案

                  你检查过+[MFMessageComposeViewController canSendText]吗?

                  来自 MFMessageComposeViewController 类参考,

                  在呈现消息组合视图之前,调用 canSendText 类方法以确保用户的设备已正确配置.如果 canSendText 方法返回 NO,请不要尝试显示消息组合视图.如果 SMS 传送不可用,您可以通知用户或直接在您的应用程序中禁用 SMS 功能.

                  Before presenting a message composition view, call the canSendText class method to ensure that the user’s device is appropriately configured. Do not attempt to present a message composition view if the canSendText method returns NO. If SMS delivery isn’t available, you can notify the user or simply disable the SMS features in your application.

                  从 iOS 5 开始,您可以注册以通过 MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification 通知的方式接收短信发送可用性更改的通知.

                  Starting in iOS 5, you can register to be notified of changes to the availability of text message sending by way of the MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification notification.

                  可能返回 nil 的原因:

                  • 设备未运行 iOS 4.
                  • 设备是未启用 iMessage 的 iPod Touch/iPad.
                  • 没有 SIM 卡?(该视图现在显示在 iOS 6 中;应用不会收到消息发送失败的通知.)
                  • 设备"其实就是模拟器.(也许这也适用于 iOS 6.)

                  同样,[[MFMailComposeViewController alloc] init] 在未启用邮件帐户时返回 nil(您可以通过在设置中禁用帐户来快速测试),但也会显示为您提供未配置邮件帐户"警报.MFMessageComposeViewController 不这样做.

                  Similarly, [[MFMailComposeViewController alloc] init] returns nil when no mail accounts are enabled (you can quickly test this by disabling accounts in Settings), but also shows a "No mail accounts configured" alert for you. MFMessageComposeViewController does not do this.

                  这篇关于MFMessageComposeViewController alloc 返回 nil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  EAAccessory/EASession teardown during background(EAAccessory/EASession 在后台拆除)
                  Getting an NSArray of a single attribute from an NSArray(从 NSArray 获取单个属性的 NSArray)
                  ImageIO: lt;ERRORgt; JPEG Corrupt JPEG data: premature end of data segment iphone - how to catch this?(ImageIO:lt;错误gt;JPEG 损坏的 JPEG 数据:iphone 数据段过早结束 - 如何捕捉到这个?)
                  Xcode iOS organizer submit to app store yields quot;The archive is invalidquot; error(Xcode iOS 管理器提交到应用商店产生“存档无效;错误)
                  How to add and get the values from .plist in iOS(如何在 iOS 中从 .plist 添加和获取值)
                  Mobile Device Management with iPhone(使用 iPhone 进行移动设备管理)

                  <tfoot id='LUaiD'></tfoot>

                  <small id='LUaiD'></small><noframes id='LUaiD'>

                    1. <legend id='LUaiD'><style id='LUaiD'><dir id='LUaiD'><q id='LUaiD'></q></dir></style></legend>

                          <tbody id='LUaiD'></tbody>
                        • <bdo id='LUaiD'></bdo><ul id='LUaiD'></ul>
                          <i id='LUaiD'><tr id='LUaiD'><dt id='LUaiD'><q id='LUaiD'><span id='LUaiD'><b id='LUaiD'><form id='LUaiD'><ins id='LUaiD'></ins><ul id='LUaiD'></ul><sub id='LUaiD'></sub></form><legend id='LUaiD'></legend><bdo id='LUaiD'><pre id='LUaiD'><center id='LUaiD'></center></pre></bdo></b><th id='LUaiD'></th></span></q></dt></tr></i><div id='LUaiD'><tfoot id='LUaiD'></tfoot><dl id='LUaiD'><fieldset id='LUaiD'></fieldset></dl></div>