简体   繁体   中英

Error when posting to Facebook Wall from iPhone app

I'm building an app that allowed me to post to a user's wall on facebook. This functionality was working fine up until recently, when for some reason, if I try to post to the wall on facebook, I am now getting the error:

"The post's action links must be valid url's. You can see this because you are one of the developers of the app."

Does anyone know why this is happening? I did not change the code at all in my app, and after searching the web, found others are also having the same problem when trying to post to their facebook wall, but without a solution. Does anyone know what is wrong here, and how to fix it?

How old is the code that you are working with? And, are you using OAth 2.0? If you're not you should, because I believe OAuth 1.0 has been deprecated by Facebook and is only supported for "legacy" applications.

I found the solution to my problem. The relevant code that was causing the problem is:

- (void)postToWall {

    FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
    dialog.userMessagePrompt = @"Enter your message:";
    dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"Check out this great restaurant!\",\"href\":\"/\",\"caption\":\"%@\",\"description\":\"%@ \r %@, %@ %@\",\"media\":[{\"type\":\"image\",\"src\":\"http://www.muslimgreenpages.ca/images/gethalal/GetHalal_IC_B_03.png\",\"href\":\"http://www.gethalalapp.com/\"}]}",
                         restaurantObj.name, restaurantObj.address, restaurantObj.city, restaurantObj.provinceState, restaurantObj.phoneNumber];
    dialog.actionLinks = @"[{\"text\":\"Download GetHalal!\",\"href\":\"http://www.gethalalapp.com/\"}]";

    [dialog show];
    _posting = NO;
    [_session logout];  

}

In my dialog.attachment, I did not provide a value for the href parameter, so I simply removed it, and everything worked! Thanks very much mdominick for trying to help.

Take care.

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