user_friends - пользователю не разрешено просматривать это приложение в соответствии с конфигурацией набора разработчика

public class Component_A{
    public static int iCount;
    public string name {get;set;}
    public Component_A(){
        name = String.Format("ComponentA_{0}", iCount++);
    }
}

public class Component_B{
    public static int iCount;
    public string name {get;set;}
    public Component_A(){
        name = String.Format("ComponentB_{0}", iCount++);
    }
}

public class Generator(){
    public List<String> generateComponent(){
        Component_A a1 = new Component_A();
        Component_A a2 = new Component_A();
        Component_B b1 = new Component_B();

        List<string> strList = new List<string>();
        strList.Add(a1.name);
        strList.Add(a2.name);
        strList.Add(b1.name);

        return strList;
    }
    public void reset() {
        Component_A.iCount = 0;
        Component_B.iCount = 0;
    }
}

Просто изменил iCount на публикацию и добавил метод сброса, чтобы изменить iCount s на 0.

Используйте его следующим образом:

public class MainClass(){
    public static void main(){
        Generator gen;
        for(int i=0; i<2; i++){
            gen = new Generator();
            List<String> componentNameList = gen.generateComponent();

            foreach(var s in componentNameList){
                Console.Out.WriteLine(s);
            }
            gen.reset();
            Console.Out.WriteLine();
        }

    }
}

EDIT: Поскольку у вас есть 100 компонентов, отражение кажется хорошим выбором. Я переместил компоненты в свой класс.

public class Components{
    public class Component_A{
        public static int iCount;
        public string name {get;set;}
        public Component_A(){
            name = String.Format("ComponentA_{0}", iCount++);
        }
    }

    public class Component_B{
        public static int iCount;
        public string name {get;set;}
        public Component_B(){
            name = String.Format("ComponentB_{0}", iCount++);
        }
    }
}

public class Generator {
    public List<String> generateComponent(){
        var a1 = new Components.Component_A();
        var a2 = new Components.Component_A();
        var b1 = new Components.Component_B();

        List<string> strList = new List<string>();
        strList.Add(a1.name);
        strList.Add(a2.name);
        strList.Add(b1.name);

        return strList;
    }
    public void reset() {
        var components = typeof(Components).GetNestedTypes().ToList();
        foreach (var component in components) {
            var property = component.GetField("iCount", BindingFlags.Public | BindingFlags.Static);
            property.SetValue(null, 0);
        }
    }
}
0
задан Shogo Yahagi 19 January 2019 в 20:39
поделиться

1 ответ

Ошибка пользователя: (

  1. Я использовал неправильный appId (используя prod appId вместо Test App app)
  2. Мне нужно указать область действия как 2-й аргумент для входа в систему метод из SDK
fb.login(response => {
    dispatch(facebookLogin(response, fb, onLogin));
}, {
    scope: 'user_friends'
});
0
ответ дан Shogo Yahagi 19 January 2019 в 20:39
поделиться
Другие вопросы по тегам:

Похожие вопросы: