UIActivityViewController图像共享无法与Facebook一起使用

时间:2015-11-05 02:58:08

标签: objective-c facebook uiactivityviewcontroller

我正在使用带有

的UIActivityViewController
SPMessageProvider *messageProvider = [[SPMessageProvider alloc] initWithSubject:@"Try it out!" message:shareText];
SPImageProvider *imageProvider = [[SPImageProvider alloc] initWithImage:shareImage];
SPURLProvider *urlProvider = [SPURLProvider new];

NSArray *activityItems = @[ messageProvider, imageProvider, urlProvider ];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];

SPImageProvider如下:

@implementation SPImageProvider

- (instancetype)initWithImage:(UIImage*)image {
  self = [super initWithPlaceholderItem:@"Placeholder image item"];

  if (!self) {
    return nil;
  }

  _image = image;

  return self;
}


- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController {
  return @"";
}

- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {
  return _image;
}

- (NSString *)activityViewController:(UIActivityViewController *)activityViewController dataTypeIdentifierForActivityType:(NSString *)activityType {
  return (__bridge NSString*)kUTTypeImage;
}

@end

点击Facebook共享选项时,对话框会打开,但图像永远不会出现(文字也不会出现,但我相信不再允许)。该图显示了Twitter选项。知道为什么它不适用于Facebook吗?

0 个答案:

没有答案