I am trying to post to Facebook from my iPhone app and it just doesn't work.
This is what I am doing:
if (![_facebook isSessionValid])
{
NSArray *permissions = [NSArray arrayWithObjects:
@"read_stream", @"publish_stream", @"offline_access",nil];
[facebook authorize:permissions delegate:self];
}
NSMutableDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
@"User Prompt Message", @"user_message_prompt",
@"http://www.mywebsite.com/", @"link",
@"http://mywebsite.com/wp-content/uploads/2011/05/iTunesArtwork.png", @"picture",
nil];
[facebook requestWithGraphPath:@"me/feed"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
I also tried
[self.facebook dialog:@"feed" andParams:params andDelegate:self];
but in either case my app is getting terminated either in
- (FBRequest*)openUrl:(NSString *)url params:(NSMutableDictionary *)params httpMethod:(NSString *)httpMethod delegate:(id)delegate
or in
- (void)dialog:(NSString *)action andParams:(NSMutableDictionary *)params andDelegate:(id )delegate
depending on which method I call with this log:
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'
It doesn't make sense to me because the dictionaries being used are mutable.
Am I doing something wrong? Any help would be much appreciated.