简体   繁体   中英

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 :

this api method is used :

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*)]? 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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