小编Eri*_* J.的帖子

TestFlight拒绝构建"get-task-allow"错误

所以我使用testflightapp来分发ad-hoc构建.

但我不断收到此消息:'无效的配置文件:分发构建权利必须将get-task-allow设置为false.

我的应用程序没有权利文件,因此XCode会自动生成一个并将其包含在构建中.我解压缩App.ipa并打开embedded.mobileprovision文件并查看权利字典.

它看起来像这样:

<key>Entitlements</key>
<dict>
    <key>application-identifier</key>
    <string>E9PBH9V8TB.*</string>
    <key>get-task-allow</key>
    <false/>
    <key>keychain-access-groups</key>
    <array>
        <string>E9PBH9V8TB.*</string>
    </array>
</dict>
Run Code Online (Sandbox Code Playgroud)

之前有其他人经历过吗?我不明白为什么我会收到这个错误.

testflight

39
推荐指数
4
解决办法
3万
查看次数

如何创建只读的ObservableCollection属性?

我想在包含对象列表(来自数据库)的视图模型上公开属性.

我需要这个集合是只读的.也就是说,我想阻止添加/删除等.但是允许foreach和indexers工作.我的目的是声明一个包含可编辑集合的私有字段,并使用只读公共属性引用它.如下

public ObservableCollection<foo> CollectionOfFoo { 
     get { 
         return _CollectionOfFoo;
     }
}
Run Code Online (Sandbox Code Playgroud)

但是,该语法只会阻止更改对集合的引用.它不会阻止添加/删除等

完成此任务的正确方法是什么?

.net c# wpf observablecollection

36
推荐指数
2
解决办法
2万
查看次数

使用Visual Studio 2012在当前上下文中运行/调试测试

在VS2010中,可以在当前上下文中运行或调试测试.

这样可以轻松点击我刚刚添加或修改的测试并运行它(Ctrl- R T)或调试它(Ctrl- R Ctrl- T).(或用我的游戏键盘...... G1;-)

我能找到运行特定测试的唯一方法是在Test Explorer中找到它并从那里运行它.这需要将我的注意力从我正在处理的代码上移开.

在Visual Studio 2012中是否存在与当前上下文等效的内容?

unit-testing visual-studio-2012

34
推荐指数
3
解决办法
2万
查看次数

JavaScript - 未找到导出默认值

我有一个Vue 2项目,我编写了一个简单的函数来翻译几个月的日期,我想在我的一个组件中导入,但是我收到一个错误:

在'@/utils/date-translation'中找不到导出'default'(导入为'translateDate')

来自src文件夹的相对文件路径是正确的,我正在导出这样的函数:

export function translateDate(date) {
  // my code
}
Run Code Online (Sandbox Code Playgroud)

然后我在组件中导入它,如下所示:

import translateDate from '@/utils/date-translation'
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

javascript import module ecmascript-6 vue.js

33
推荐指数
3
解决办法
4万
查看次数

将逗号分隔列表连接到逗号分隔并用单引号括起来

List<string> test = new List<string>();
test.Add("test's");
test.Add("test");
test.Add("test's more");
string s = string.Format("'{0}'", string.Join("','", test));
Run Code Online (Sandbox Code Playgroud)

现在s是,'test's','test','test's more' 但我需要用2个单引号替换内部引号

像这样: 'test''s','test','test''s more'

更新:我得到它如下工作,但我希望如果可能的话更清洁.

string s = string.Format("`{0}`", string.Join("`,`", test)).Replace("'", "''").Replace("`", "'");
Run Code Online (Sandbox Code Playgroud)

c# string string-formatting c#-4.0

32
推荐指数
3
解决办法
5万
查看次数

如何在.Net中实现ConcurrentHashSet

我试图在ConcurrentDictionary的精神中实现一个ConcurrentHashSet,采取的方法是使用内部支持ConcurrentDictionary并编写小的委托方法,这是我得到了多远,但很好的设置理论方法是我坚持,尤其是.我不确定我是否可以使用foreach并且仍然不违反并发性

public class ConcurrentHashSet<TElement> : ISet<TElement>
{
    private readonly ConcurrentDictionary<TElement, object> _internal;

    public ConcurrentHashSet(IEnumerable<TElement> elements = null)
    {
        _internal = new ConcurrentDictionary<TElement, object>();
        if (elements != null)
            UnionWith(elements);
    }

    public void UnionWith(IEnumerable<TElement> other)
    {
        if (other == null) throw new ArgumentNullException("other");

        foreach (var otherElement in other)
            Add(otherElement);
    }

    public void IntersectWith(IEnumerable<TElement> other)
    {
        throw new NotImplementedException();
    }

    public void ExceptWith(IEnumerable<TElement> other)
    {
        throw new NotImplementedException();
    }

    public void SymmetricExceptWith(IEnumerable<TElement> other)
    {
        throw new NotImplementedException();
    }

    public bool IsSubsetOf(IEnumerable<TElement> other)
    { …
Run Code Online (Sandbox Code Playgroud)

.net c# concurrency dictionary hashset

31
推荐指数
3
解决办法
2万
查看次数

反序列化时,C#类中的字段初始化程序不运行

我有一个定义受保护字段的类.受保护的字段具有字段初始值设定项.

当我反序列化具体类时,不会运行字段初始值设定项.为什么?解决问题的最佳模式是什么?如果我将初始化移动到构造函数中,也不会调用构造函数.

[DataContract]
public class MyConcrete
{
    // FIELD INITIALIZER DOES NOT RUN WHEN COMMENTED IN:
    protected readonly Dictionary<int, string> myDict;// = new Dictionary<int, string>();

    public MyConcrete()
    {
        myDict = new Dictionary<int, string>();
    }

    private bool MyMethod(int key)
    {
        return myDict.ContainsKey(key);
    }

    private int myProp;

    [DataMember]
    public int MyProp
    {
        get { return myProp; }
        set { bool b = MyMethod(value); myProp = value; } // Call MyMethod to provoke error
    }
}
Run Code Online (Sandbox Code Playgroud)

原始类层次结构

[DataContract]
public abstract class MyAbstract
{ …
Run Code Online (Sandbox Code Playgroud)

c# serialization

28
推荐指数
2
解决办法
6165
查看次数

HTML 5拖放jQuery UI拖放的优点

我正在编写一个新的Web应用程序,需要支持页面上元素的拖放操作(而不是文件拖放).

这就是这个问题的答案

html5 vs jquery拖放

建议使用Modernizr检查浏览器是否支持HTML5拖放,并使用该支持或退回到jQuery UI之类的替代方案.

由于它们具有完全不同的模型,这意味着必须单独实现和测试所有拖放代码(非常少的共享实现).如果对HTML5拖放有重大的,对用户有影响的好处,并且如果回退到jQuery UI会提供降级的体验,那么这似乎是合乎逻辑的.

实施这两种变体是否有显着的好处?

html5 drag-and-drop jquery-ui-draggable

26
推荐指数
3
解决办法
1万
查看次数

适用于Windows的Slik SVN客户端的Subversion全局配置文件在哪里?

有谁知道SVN全局配置文件适用于Windows的Slik SVN客户端?特别是64位?

svn windows slik

25
推荐指数
2
解决办法
2万
查看次数

在EF Query中包含孙子孙女

给定对象层次结构

public class Parent
{
    public int Id { get; set; }
    public virtual Child Child { get; set; }
}

public class Child
{
    public int Id { get; set; }
    public virtual GrandChild GrandChild { get; set; }
}

public class GrandChild
{
    public int Id { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

和DB上下文

public class MyContext : DbContext
{
    public DbSet<Parent> Parents { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

可以包括使用Lambda语法(using System.Data.Entity)的子孙,如下所示:

using (MyContext ctx = new MyContext())
{
    var …
Run Code Online (Sandbox Code Playgroud)

linq-to-entities entity-framework

24
推荐指数
2
解决办法
7804
查看次数