ideashower/ShareKit — Issue #313: Intermittent problem trying to send a URL, text, and image to FB
Author: jondspa
Created: 2011-10-26 20:33:46+00:00
State: open

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:

100
Invalid parameter

method
facebook.auth.getSession

format
XML

sig
55bcebbdcbe75e002103f31eb04b85f4

auth_token
7bd4ed76f2c79ad1f206172faa297193

v
1.0

api_key
217148968342579

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

Thanks,

- Jon