【问题标题】:iOS 4 SMS composer not working correctlyiOS 4 SMS 编写器无法正常工作
【发布时间】:2012-03-15 17:15:06
【问题描述】:

我在我的应用程序中显示一个 MFMessageComposeViewController,在 iOS 5 上一切都很好,但是一些用户测试抱怨 iOS 4,似乎由于我下面的代码而出现的视图控制器正在显示一个空的 SMS撰写,此外没有顶部导航项,例如取消按钮甚至标题“新消息”。

我手头没有任何 iOS 4 设备(我知道这很糟糕),因此我无法直接解决问题并对其进行调试。

谁能看看我做错了什么?附上我发过来的问题截图,很奇怪。

BOOL canText = [MFMessageComposeViewController canSendText];

if(canText){
    MFMessageComposeViewController * smsViewController = [[MFMessageComposeViewController alloc] init];
    if(smsViewController){

        smsViewController.body = @"test message";
        smsViewController.messageComposeDelegate = self;

        [self presentModalViewController:smsViewController animated:YES];
        [smsViewController release];

    }else{
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"SMS" 
                                                        message:@"Your cannot send SMS on this device." 
                                                       delegate:nil 
                                              cancelButtonTitle:@"ok" 
                                              otherButtonTitles:nil];

        [alert show];
        [alert release];

    }
}else{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"SMS" 
                                                    message:@"Your cannot send SMS on this device." 
                                                   delegate:nil 
                                          cancelButtonTitle:@"ok" 
                                          otherButtonTitles:nil];

    [alert show];
    [alert release];

}

【问题讨论】:

  • 你在iOS 4.3模拟器上试过了吗?
  • 是的,正如预测的那样,canSendText 返回 NO,所以我没有显示除警报以外的任何内容
  • 哦,当然——我的错——从我这边看,这不是一个聪明的问题;)...

标签: ios cocoa-touch


【解决方案1】:

我有一个 UINavigationBar 类别通过覆盖 viewWillAppear 在栏下添加阴影,这破坏了视图。这就是发生的事情。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 2019-03-24
    • 1970-01-01
    • 2016-07-17
    • 2020-01-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多