假设我想用空格分割字符串.此代码段在Swift 1.x中正常工作.它在Xcode 7 Beta 1中的Swift 2中不起作用.
var str = "Hello Bob"
var foo = split(str) {$0 == " "}
Run Code Online (Sandbox Code Playgroud)
我得到以下编译器错误:
Cannot invoke 'split' with an argument list of type '(String, (_) -> _)
Run Code Online (Sandbox Code Playgroud)
有人知道怎么称呼这个吗?
更新:添加了一条说明,这是针对Xcode 7 beta 1的.
我在使用CTP 5中的实体框架代码优先级东西时遇到问题.它正在对对象进行缓存,我不希望它.例如,我加载了一个加载对象的页面(使用ASP.NET MVC站点).然后我去更改数据库.我重新加载页面,并没有反映更改.如果我杀死该网站并重新运行它,那么它显然会重新获取.对于类型,甚至是特定查询,我如何告诉它始终获取新副本.我认为它可能与MergeOption有关,但我很难找到适用于CTP 5的示例.谢谢.
你好.我试图解决一个显然并不罕见的问题,我不知道如何找到这个问题是如何解决的.当我通过IIS在我的机器上运行StructureMap时,我得到一个异常,它看起来像这样:
**Description**: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
**Exception Details**: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Run Code Online (Sandbox Code Playgroud)
这个问题已经出现在SO(/sf/ask/54926651/),这篇博客文章的评论和大约一年前的结构图邮件列表上.
我的问题不是在外部托管环境中运行它.我甚至不能让它在我自己的盒子上运行(IIS 7.5,Win7 RC,.NET 3.5).我试图将站点配置为使用自定义策略文件,并且FileIOPermission被标记为具有不受限制的访问权限...没有骰子.如果有人有一些提示或链接,将不胜感激.
更新 因此,这是解决问题的最佳方法,但是在深入探讨Joshua所提到的内容之后,我需要做的就是让它工作:StructureMap,Code Access Security和一个糟糕的解决方案一个问题.将会有一个更好的解决方案.