I use the FB SDK so that users can invite friends to download my application. I create an FB request when the user clicks the invitation button. The action is as follows:
- (IBAction)inviteButtonPressed:(UIButton *)sender { // create a dictionary for our dialog parameters NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity: 7]; // set the frictionless requests parameter to "1" [params setObject: @"1" forKey:@"frictionless"]; [params setObject: @"Test Invite" forKey:@"title"]; [params setObject:appID forKey:@"app_id"]; [params setObject: @"Test" forKey: @"message"]; if([friendsToInvite count] != 0){ [params setObject:friendsToInvite forKey:@"to"]; NSLog(@"%@", params); } // show the request dialog [facebook dialog:@"apprequests" andParams:params andDelegate: nil]; }
The problem is that I am passing an array of friends (selected by the user) for the @ "to" property object. So the Facebook library is trying to parse the @ "to" object (code from Facebook):
id fbid = [params objectForKey:@"to"]; if (fbid != nil) {
My code gives me this error:
-[__NSArrayM UTF8String]: unrecognized selector sent to instance 0x1aea00 2012-05-08 01:48:29.958 shmob[2976:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM UTF8String]: unrecognized selector sent to instance 0x1aea00'
When I rigidly bind one application identifier to an @ "to" object, it works! Do you know how I can invite a Facebook friend list?
source share