小编Muh*_*lvi的帖子

Facebook登录CallbackManager没有调用FacebookCallback?

  • 我尝试使用LoginButton登录但是没有调用登录回调.(LoginButton在片段中).
  • 在Application onCreate中调用FacebookSdk.sdkInitialize
  • 登录完成后不会调用回调.这是代码:

活动:

public class FrameActivity extends BaseActivity {

 public static CallbackManager callbackManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
// FacebookSdk.sdkInitialize is called in the Application onCreate

callbackManager = CallbackManager.Factory.create();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);

}
}
Run Code Online (Sandbox Code Playgroud)

分段:

 @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_login, container, false);
    LoginButton loginButton = (LoginButton) view.findViewById(R.id.login_button); …
Run Code Online (Sandbox Code Playgroud)

android facebook

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

iOS - Facebook登录错误 - 构建URL时出现未知错误(com.facebook.sdk.core错误3)

我正在使用Facebook登录为我的iOS应用程序开发iOS 8及更高版本.(正在使用最新的Facebook SDK)

我遵循了Facebook官方指南中描述的所有基本步骤.但是,当我单击登录按钮时,它会给我以下错误:

构建URL的未知错误(com.facebook.sdk.core错误3)

我已经检查过,看看我可能做错了什么,但一切似乎都按照指南,我已经被困在这里一天了.

FB登录代表的代码:

class FBLoginDelegate: NSObject,  FBSDKLoginButtonDelegate  {


func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!){
    if(error == nil){
        print("Logged In from Btn")
    }else{
        print("Error: \(error.localizedDescription)") //Here it gives the error 
    }

}
}
Run Code Online (Sandbox Code Playgroud)

FB登录按钮代码:

      var fbLoginBtnDelegate = FBLoginDelegate()
    let fbBtnWidth = self.view.bounds.width - (self.fbContainerLeftConstraint.constant + self.fbContainerRightConstraint.constant)
    let fbLoginButton = FBSDKLoginButton(frame: CGRectMake(0,0,fbBtnWidth,self.fbButtonContainer.bounds.size.height))

    self.fbButtonContainer.addSubview(fbLoginButton)
    fbLoginButton.readPermissions = ["public_profile", "user_friends", "email", "user_birthday"]
    fbLoginButton.delegate = fbLoginBtnDelegate
Run Code Online (Sandbox Code Playgroud)

facebook facebook-graph-api ios facebook-login

22
推荐指数
3
解决办法
6955
查看次数

如何使回收者视图开始从中心添加项目?

  • 我有一个带有"Horziontal Linear Layout"的recyclerView作为布局管理器.
  • Recycler View采用框架布局,layout_gravity ="center",layout_width ="wrap_content"
  • 我希望回收站视图开始从中心添加项目.
  • 这就是我想要的:

在此输入图像描述

在此输入图像描述

在此输入图像描述

  • 这是我得到的:

在此输入图像描述

  • 您可以看到,在最后一个图像中,项目是从左侧添加的.我想让它从中心添加项目,如前三张图片所示.

android android-recyclerview

14
推荐指数
2
解决办法
8106
查看次数

CPython - 读取C函数内的Python字典(键/值)作为参数传递

我正在编写Python C扩展.我正在将Python Dictionary传递给C函数.我可以使用以下代码解析它:

PyObject *large_dict = NULL;
if (! PyArg_ParseTuple( args, "O!", &PyDict_Type, &large_dict)) return NULL;
if (large_dict != NULL)
{
   printf("Large Dictionary Not Null\n");
}
Run Code Online (Sandbox Code Playgroud)

这里打印了"Large Dictionary Not Null"语句,这意味着字典被成功解析.现在我想通过指定键来访问字典值,就像在python中一样.即dict ['k1'],这给出了值v1.

如何访问此C函数中的字典键/值?

请建议我一个解决方案?

python cpython python-2.7

5
推荐指数
1
解决办法
2612
查看次数

为 get 和 post 请求定义不同的架构 - AutoSchema Django Rest Framework

我正在尝试为 Django REST 框架中的 REST API 定义 AutoSchema(将在 django Rest Framework swagger 中显示)。这个类扩展了 APIView。

该类具有“get”和“post”方法。喜欢:

class Profile(APIView):
permission_classes = (permissions.AllowAny,)
schema = AutoSchema(
    manual_fields=[
        coreapi.Field("username",
                      required=True,
                      location='query',
                      description='Username of the user'),

    ]
)
def get(self, request):
    return
schema = AutoSchema(
    manual_fields=[
        coreapi.Field("username",
                      required=True,
                      location='form',
                      description='Username of the user '),
        coreapi.Field("bio",
                      required=True,
                      location='form',
                      description='Bio of the user'),

    ]
)
def post(self, request):
    return
Run Code Online (Sandbox Code Playgroud)

问题是我想要不同的 get 和 post 请求模式。如何使用 AutoSchema 实现这一目标?

python django django-rest-framework django-rest-swagger

5
推荐指数
1
解决办法
4584
查看次数