- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我搜索了很多有关如何在 Java 中使用 instagram_graph_user_profile
权限的信息,但找不到任何相关内容。
这是我的代码:
private void init_instagram() {
FacebookSdk.setApplicationId(getString(R.string.facebook_app_id));
FacebookSdk.sdkInitialize(this.getApplicationContext());
if (BuildConfig.DEBUG) {
FacebookSdk.setIsDebugEnabled(true);
FacebookSdk.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
}
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), (object, response) -> {
if (object != null) {
Log.e(TAG, object.toString());
} else {
Log.e(TAG, "null");
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "instagram_graph_user_profile");//instagram_graph_user_profile
request.setParameters(parameters);
request.executeAsync();
}
@Override
public void onCancel() {
Log.e(TAG, "onCancel");
}
@Override
public void onError(FacebookException exception) {
Log.e(TAG, exception.toString());
}
});
}
当我按下按钮时:
connectInstagram.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LoginManager.getInstance().logInWithReadPermissions(MyProfileActivity.this,
Arrays.asList("instagram_graph_user_profile"));
}
});
它返回此错误消息:
Unsupported get request. Object with ID '2674********80' does not exist, cannot be loaded due to missing permissions, or does not support this operation
并重定向到 Facebook 页面,并显示消息“抱歉,出了点问题。我们正在处理该问题,我们会尽快修复它。”
或者在控制台日志中给我这个错误:
E/GraphResponse: {HttpStatus: 400, errorCode: 104, subErrorCode: -1, errorType: OAuthException, errorMessage: An access token is required to request this resource.}
最佳答案
我搜索了很多有关如何在 Java 中使用 instagram_graph_user_profile
权限的信息,但找不到任何相关内容。
这是我的代码:
private void init_instagram() {
FacebookSdk.setApplicationId(getString(R.string.facebook_app_id));
FacebookSdk.sdkInitialize(this.getApplicationContext());
if (BuildConfig.DEBUG) {
FacebookSdk.setIsDebugEnabled(true);
FacebookSdk.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
}
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), (object, response) -> {
if (object != null) {
Log.e(TAG, object.toString());
} else {
Log.e(TAG, "null");
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "instagram_graph_user_profile");//instagram_graph_user_profile
request.setParameters(parameters);
request.executeAsync();
}
@Override
public void onCancel() {
Log.e(TAG, "onCancel");
}
@Override
public void onError(FacebookException exception) {
Log.e(TAG, exception.toString());
}
});
}
当我按下按钮时:
connectInstagram.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LoginManager.getInstance().logInWithReadPermissions(MyProfileActivity.this,
Arrays.asList("instagram_graph_user_profile"));
}
});
它返回此错误消息:
Unsupported get request. Object with ID '2674********80' does not exist, cannot be loaded due to missing permissions, or does not support this operation
并重定向到 Facebook 页面,并显示消息“抱歉,出了点问题。我们正在处理该问题,我们会尽快修复它。”
或者在控制台日志中给我这个错误:
E/GraphResponse: {HttpStatus: 400, errorCode: 104, subErrorCode: -1, errorType: OAuthException, errorMessage: An access token is required to request this resource.}
关于java - 如何在Java中使用instagram_graph_user_profile权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60526903/
我是一名优秀的程序员,十分优秀!