내 앱에 페이스 북을 intergrating하기 위해이 라이브러리를 사용하고 있습니다 : https://github.com/sromku/android-simple-facebook. 프로필, 친구 목록 등에 액세스 할 때 잘 작동합니다. 그러나 벽에 사진을 게시하려고 할 때 일반 SDK를 사용하지만 작동하지 않습니다. 이 경우 벽/페이지/그룹에 사진을 게시하는 기능을 지원하지 않기 때문에 라이브러리를 사용하지 않습니다.Facebook Android SDK - 프로필을 읽을 수는 있지만 벽에 사진을 게시 할 수는 없습니다.
나는이 요청 권한을 게시하고 화재 요청 후 내가 가지고있는 세션을 전달합니다
public void uploadToFaceWall() {
Session session = mFaceSession;
if (session != null){
String fbPhotoAddress = null;
Request.Callback uploadPhotoRequestCallback = new Request.Callback() {
@Override
public void onCompleted(Response response) {
if (response.getError() != null) {
Log.d(TAG, "error: "+response.toString()):
}
Object graphResponse = response.getGraphObject().getProperty("id");
if (graphResponse == null || !(graphResponse instanceof String) ||
TextUtils.isEmpty((String) graphResponse)) {
Log.d(TAG, "failed photo upload/no response");
} else {
finish();
}
}
};
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = null;
try {
bitmap = BitmapFactory.decodeFile(myFacePost.getImages().getString(0), options);
} catch (JSONException e) {
e.printStackTrace();
}
Bundle parameters = new Bundle();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
parameters.putByteArray("picture", byteArray);
parameters.putString("message", "Check out my picture");
Request req = new Request(session, "me/photos", parameters, HttpMethod.POST, uploadPhotoRequestCallback);
req.executeAndWait();
}
}
그러나이 작동하지 않는, 그리고 응답 오류가 포함되어
{Response: responseCode: 200, graphObject: null, error: {HttpStatus: -1, errorCode: -1, errorType: null, errorMessage: java.lang.NullPointerException}, isFromCache:false}
mFaceSession
이입니다 세션 사용자가 새로운 게시 권한을 수락하면
디버깅 할 때 세션이 열린 것을 알 수 있습니다.
이것이 작동하지 않는 이유는 무엇입니까?