我测试了它并阅读了Open-Graph API参考,我不知道这里有什么问题我在真实设备和模拟器中进行了测试 我尝试上传带按摩的照片,这是我阅读从我的游戏屏幕截图和状态发送的最佳方式,mybe我错了但这是我发现任何我有这个错误,当我尝试卸载照片时:
使用这种api方法:
FBRequest *fbr = [FBRequest requestWithGraphPath:[NSString stringWithUTF8String:request->getGraphPath().c_str()]
parameters:screw::ios::Helper::valueMap2nsDictionary(request->getParams())
HTTPMethod:__getHTTPMethod(request->getMethod())];
打印输出日志:
014-09-07 23:30:32.112 GuessGame iOS[4065:60b] RequestApple::execute
{
graphPath = me/photos
method = 1
params =
{
source: /Users/foo/Library/Application Support/iPhone Simulator/7.1/Applications/C60C9A5E-6252-4494-B2FD-6285A9E60785/Documents/TestImg.png
message: message,picture
}
}
2014-09-07 23:31:11.477 GuessGame iOS[4065:60b] RequestApple: POST "me/photos" completed, error = Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xa747050 {com.facebook.sdk:HTTPStatusCode=400, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 324;
message = "(#324) Requires upload file";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0xa70a390, state: FBSessionStateOpen, loginHandler: 0x8a97d0, appID: 307072892830184, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0xa707670>, expirationDate: 2014-11-06 19:18:33 +0000, refreshDate: 2014-09-07 20:07:39 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
"public_profile",
"publish_actions",
"user_friends"
)>}
2014-09-07 23:31:11.477 GuessGame iOS[4065:60b] Result = (null)
2014-09-07 23:31:17.487 GuessGame iOS[4065:60b] SessionApple::StatusCallback
{
state = 514
permissions = (
"public_profile",
"publish_actions",
"user_photos",
"user_friends"
)
error = (null)
}
cocos2d: Session::updateState - state = OPENED_TOKEN_UPDATED
cocos2d: Session::updateState - permissions = (public_profile,publish_actions,user_photos,user_friends)
我在这里做错了什么?
答案 0 :(得分:0)
为什么不使用[FBRequest requestForUploadPhoto:(UIImage *)]? https://developers.facebook.com/docs/reference/ios/current/class/FBRequest/#requestForUploadPhoto:
这样你就不必构建自己的字典了,只需传入一个UIImage对象。