ideashower / ShareKit

Drop in sharing features for all iPhone and iPad apps

Home Page:http://getsharekit.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intermittent problem trying to send a URL, text, and image to FB

jondspa opened this issue · comments

Hi -

I'm trying to send a URL, image, title, and some text to Facebook. I modified ShareKit and thought I had it working. Turns out I intermittently get an error from facebook that the connection wasn't set up properly and then ShareKit doesn't work. I think my modifications are pretty straightforward.

In SHKItem.m, I added:

+ (SHKItem *)URL:(NSURL *)url title:(NSString *)title text:(NSString *)text picURL:(NSURL *)picURL
{
    SHKItem *item = [[SHKItem alloc] init];
    item.shareType = SHKShareTypeURL;
    item.URL = url;
    item.title = title;
    item.text = text;
    item.picURL = picURL;   
    return [item autorelease];
}

In SHKFacebook.m I added:

if (item.picURL) {
   dialog.attachment = [NSString stringWithFormat:
                         @"{\
                         \"name\":\"%@\",\
                         \"href\":\"%@\",\
                         \"media\":[{\"type\":\"image\",\
                         \"src\":\"%@\",\
                         \"href\":\"http://itunes.apple.com/us/app/XXXX/\"}]\
                         }",
                         item.title == nil ? SHKEncodeURL(item.URL) : SHKEncode(item.title),
                         SHKEncodeURL(item.URL),
                         SHKEncodeURL(item.picURL)
                         ];
        } 

The intermittent behavior I'm seeing is that after I log on to facebook via ShareKit, the phone screen blinks and I never see the Publish Story pop-up window. I put some trace messages in the fbconnect code and, when the intermittent error occurs, I'm seeing an error 100, invalid parameter in the connectionDidFinish XML that comes back from facebook:

<?xml version="1.0" encoding="UTF-8"?>
<error_response xmlns="http://api.facebook.com/1.0/"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
  <error_code>100</error_code>
  <error_msg>Invalid parameter</error_msg>
  <request_args list="true">
    <arg>
      <key>method</key>
      <value>facebook.auth.getSession</value>
    </arg>
    <arg>
      <key>format</key>
      <value>XML</value>
    </arg>
    <arg>
      <key>sig</key>
      <value>55bcebbdcbe75e002103f31eb04b85f4</value>
    </arg>
    <arg>
      <key>auth_token</key>
      <value>7bd4ed76f2c79ad1f206172faa297193</value>
    </arg>
    <arg>
      <key>v</key>
      <value>1.0</value>
    </arg>
    <arg>
      <key>api_key</key>
      <value>217148968342579</value>
    </arg>
  </request_args>
</error_response>

I'm stumped. I think my changes to ShareKit are very minor.

Thanks,

  • Jon

More information: I've done more testing using

SHKItem *item = [SHKItem URL:url title:@"XXX"];

and it's usually fine but intermittently has the same behavior. After log in to facebook, screen flashes and don't get a Post Story pop-up.

Decided that the problem is on the facebook side. Think I had my facebook app set up slightly wrong. Wrong enough to fail to connect once every twenty times...