简体   繁体   English

使用iOS-SDK上传照片给出(#324)需要上传文件,该文件在那里

[英]Photo upload with iOS-sdk gives (#324) Requires upload file , the file is there

i tested it and read the Open-Graph API reference and i dont know what is wrong here i tested it in real device and in the simulator i try to upload photo with massage , this is as i read the best way to send from my game screen shot and status , mybe i wrong but this is what i found any i have this errors when i try to uload the photo : 我测试了它并阅读了Open-Graph API参考,但我不知道这里出了什么问题我在真实设备中进行了测试,并在模拟器中尝试通过按摩上传照片,这是我阅读了从游戏发送的最佳方法屏幕截图和状态,也许是我错了,但这是我尝试上传照片时发现的任何错误:

this api method is used : 使用此api方法:

FBRequest *fbr = [FBRequest requestWithGraphPath:[NSString stringWithUTF8String:request->getGraphPath().c_str()]
                                          parameters:screw::ios::Helper::valueMap2nsDictionary(request->getParams())
                                          HTTPMethod:__getHTTPMethod(request->getMethod())];

The output log as i print it : 当我打印输出日志时:

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)

what im doing wrong here ? 我在这里做错了什么?

Why not use [FBRequest requestForUploadPhoto:(UIImage*)]? 为什么不使用[FBRequest requestForUploadPhoto:(UIImage *)]? https://developers.facebook.com/docs/reference/ios/current/class/FBRequest/#requestForUploadPhoto : https://developers.facebook.com/docs/reference/ios/current/class/FBRequest/#requestForUploadPhoto

That way you don't have to construct your own dictionary, and can just pass in a UIImage object. 这样,您不必构造自己的字典,而只需传入UIImage对象即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM