草庐IT

iphone - MFmailcomposer 有时会出错?

coder 2023-07-29 原文

我在 iPhone 中使用 MFMailcomposer 从我的应用程序发送邮件。一切正常,但是当我将它移植到 iPhone 5 和 ios6 时

_serviceViewControllerReady:error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=1 "The operation couldn't be completed. (_UIViewServiceInterfaceErrorDomain error 1. 但如果我再次运行没有问题,它工作正常。

我是这样介绍邮件编辑器的`

action
{
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
    if (mailClass != nil)
    {
        // We must always check whether the current device is configured for sending emails
        if ([mailClass canSendMail])
        {
            [self displayComposerSheet];
        }
        else
        {
            [self launchMailAppOnDevice];
        }
    }
    else
    {
        [self launchMailAppOnDevice];
    }

}


void)displayComposerSheet 
{

    AppDelegate *appdelegate=[[UIApplication sharedApplication] delegate];
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;  

    [picker setSubject:@"report"];



    // Set up recipients
    NSArray *toRecipients=[NSArray arrayWithObject:@""]; 
    NSArray *ccRecipients =[[NSArray alloc]init];//= [NSArray arrayWithObjects:@"", @"", nil]; 
    NSArray *bccRecipients=[[NSArray alloc]init];// = [NSArray arrayWithObject:@""];    
    [picker setToRecipients:toRecipients];
    [picker setCcRecipients:ccRecipients];  
    [picker setBccRecipients:bccRecipients];    
    [picker setMessageBody:@"Please send me  now." isHTML:YES];





    [appdelegate.navigationController presentModalViewController:picker animated:YES];
    [appdelegate.navigationController.navigationBar setHidden:NO];
    [picker release];
}

`

最佳答案

我遇到了同样的问题,这似乎是一个与特定 UIAppearance 自定义相关的错误。当我删除对 UISearchBar 背景图像的自定义时,它就完全消失了。

关于iphone - MFmailcomposer 有时会出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12721462/

有关iphone - MFmailcomposer 有时会出错?的更多相关文章

  1. ruby-on-rails - 无法在centos上安装therubyracer(V8和GCC出错) - 2

    我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e

  2. ruby - 安装libv8(3.11.8.13)出错,Bundler无法继续 - 2

    运行bundleinstall后出现此错误:Gem::Package::FormatError:nometadatafoundin/Users/jeanosorio/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gemAnerroroccurredwhileinstallinglibv8(3.11.8.13),andBundlercannotcontinue.Makesurethat`geminstalllibv8-v'3.11.8.13'`succeedsbeforebundling.我试试gemin

  3. iphone - 扩展 restful_authentication/AuthLogic 以支持匿名 iPhone 的延迟登录的最佳方法是什么? - 2

    我正在构建一个与RubyonRails后端对话的iPhone应用程序。RubyonRails应用程序还将为Web用户提供服务。restful_authentication插件是提供快速和可定制的用户身份验证的绝佳方式。但是,我希望iPhone应用程序的用户在新列中存储一个由手机的唯一标识符([[UIDevicedevice]uniqueIdentifier])自动创建的帐户。稍后,当用户准备好创建用户名/密码时,帐户将更新为包含用户名和密码,iPhone唯一标识符保持不变。用户在设置用户名/密码之前不能访问该网站。然而,他们可以使用iPhone应用程序,因为该应用程序可以使用它的标识符

  4. ruby - 为什么 open ("url") 有时会返回 File 有时会返回 StringIO? - 2

    我有两个CSV文件存储在S3上。当我打开其中之一时,返回一个文件。当我打开另一个时,返回一个StringIO。fn1#=>"http://SOMEWHERE.s3.amazonaws.com/setup_data/d1/file1.csv"open(fn1)#=>#fn2#=>"http://SOMEWHERE.s3.amazonaws.com/setup_data/d2/d3/file2.csv"open(fn2)#=>#为什么?有没有办法用一致的数据类型打开它们?我需要将相同的数据类型String传递到CSV.read(open(file_url))中,如果有时它得到一个则它不起作

  5. ruby-on-rails - 在 ruby​​/rails 中,如何对日期有时可能为空的日期值进行排序? - 2

    我想按游戏日期对我的游戏进行排序,但有时游戏日期可能为空,我会得到一个异常:undefinedmethod`to_datetime'fornil:NilClass@games=@teams.reduce([]){|memo,team|memo+team.games}.sort_by(&:game_date)有什么好的方法吗? 最佳答案 如果您只想删除没有日期的条目,最简单的解决方案-ar.select(&:date).sort_by(&:date)在末尾添加nils可以用ar.select(&:date).sort_by(&:dat

  6. ruby - 为什么带有无效参数的范围有时不会导致参数错误? - 2

    以下代码会导致参数错误:n=15(n%4==0)..(n%3==0)#=>badvalueforrange(ArgumentError)我认为这是因为它评估为:false..true并且范围内使用了不同类型的类:TrueClass和FalseClass。但是,以下代码不会引发错误。这是为什么?Enumerable#collect能捕捉到它吗?(11..20).collect{|i|(i%4==0)..(i%3==0)?i:nil}#=>noerror稍后添加:如果fcn返回15,则只评估范围的前半部分deffcn(x)putsx15endif(fcn(1)%4==0)..(fcn(2)

  7. iphone - 设计和 Rails 3 中的 http 身份验证 - 2

    我有一个使用deviseonrails3的应用程序。我想启用http身份验证,以便我可以从iPhone应用程序向我的网络应用程序进行身份验证。如何从我的iPhone应用程序进行身份验证以进行设计?这安全吗?还是我应该进行不同的身份验证? 最佳答案 从设计的角度来看,您有3个选择:1)使用基本的http身份验证:您的iPhone应用程序有一个secretkey-这是在您的iPhone应用程序代码中烘焙的-用于对网络应用程序的每个请求进行身份验证。Google搜索:“设计基本的http身份验证”2)您可以通过在您的iPhone应用程序中

  8. ruby - celluloid gem 安装出错 - 2

    最近我将我的Rails版本更新到4.2.3并将ruby​​版本更新到ruby-2.2.3。之后,当我bundle它时会出现以下错误:$bundleFetchinggemmetadatafromhttp://rubygems.org/..........Fetchingversionmetadatafromhttp://rubygems.org/...Fetchingdependencymetadatafromhttp://rubygems.org/..Couldnotfindcelluloid-0.16.1inanyofthesources你能帮帮我吗? 最

  9. Ruby:对可能包含 nil 的多维数组进行排序有时会失败 - 2

    我在我的一个项目的失败测试中发现了这个例子。为什么这样做:[[1,2,3],[2,3,4],[1,1,nil]].sort#=>[[1,1,nil],[1,2,3],[2,3,4]]但这不是:[[1,2,3],[nil,3,4],[1,1,nil]].sort#=>ERROR:ArgumentError:comparisonofArraywithArrayfailed已测试的Ruby版本:2.0.0、1.9.3。 最佳答案 它失败了,因为它超过了nil。第一个测试示例没有失败的原因是1,1与1,2进行了比较。它不会达到nil的程度进

  10. ruby-on-rails - Ruby on Rails - 捆绑安装期间出错 - 2

    我一直在谷歌下面搜索这个错误,但我无法解决这个错误:Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension./usr/bin/ruby2.1extconf.rbmkmf.rbcan'tfindheaderfilesforrubyat/usr/lib/ruby/include/ruby.hextconffailed,exitcode1Gemfileswillremaininstalledin/home/dyego/.bundler/tmp/9200/gems/sqlite3-1.3.9forinspection.Results

随机推荐