Search code examples
iosfacebookimagesharing

Facebook iOS SDK share picture from App


I try share picture to Facebook. This is work.

 NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   kAppId, @"app_id",
                                   url, @"link",
                                  @"http://yandex.st/morda-logo/i/logo.png", @"picture",
                                   title, @"name",
                                   produc, @"caption",
                                   tempString, @"description",
                                   message, @"message",
                                   nil];

But I want share picture from my App. I try

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   kAppId, @"app_id",
                                   url, @"link",
                                  [UIImage imageNamed:@"nav.png"], @"picture",
                                   title, @"name",
                                   produc, @"caption",
                                   tempString, @"description",
                                   message, @"message",
                                   nil];

But I have problem:

:frame:decisionListener: delegate: -[UIImage length]: unrecognized selector sent to instance 0xc98b1d0

What am I doing wrong? Thank you very much


Solution

  • Try using "source" and not "picture". Picture is expecting the url string.

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                       kAppId, @"app_id",
                                       url, @"link",
                                      [UIImage imageNamed:@"nav.png"], @"source",
                                       title, @"name",
                                       produc, @"caption",
                                       tempString, @"description",
                                       message, @"message",
                                       nil];