本文介绍了设备上iOS 7中的UIActivityViewController中没有显示Twitter图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用UIActivityViewController从我的应用程序中分享信息到Twitter和FB,这些设置在设置中正确配置。代码是最简单的:

I am using a UIActivityViewController to share info from my app to Twitter and FB, which are properly configured in Settings. The code is the simplest possible:

- (IBAction)share {
    NSString *postText = @"some text";
    UIImage *postImage = [UIImage imageNamed:@"myImage"];
    NSURL *postURL = [NSURL URLWithString:@"myUrl"];
    NSArray *activityItems = @[postText, postImage, postURL];

    UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
    activityController.excludedActivityTypes =
    @[
      UIActivityTypePrint,
      UIActivityTypeCopyToPasteboard,
      UIActivityTypeAssignToContact,
      UIActivityTypeSaveToCameraRoll,
      UIActivityTypeCopyToPasteboard,
      UIActivityTypeMail,
      UIActivityTypeMessage,
      UIActivityTypePostToWeibo,
      ];
    [activityController setCompletionHandler:^(NSString *activityType, BOOL completed) {
        if ([activityType isEqualToString:UIActivityTypePostToFacebook]) {
            if (completed) [self doSomethingForFB];
        } else if ([activityType isEqualToString:UIActivityTypePostToTwitter]) {
            if (completed) [self doSomethingForTwitter];
        }
    }];

    [self presentViewController:activityController animated:YES completion:nil];
}

这段代码像模拟器上的一个魅力(iphone和ipad, ios7和ios6),但是在我的设备(iOS7的iPad)上,当ActivityViewController出现时,Twitter和FB就会出现,因为标签是可见的,但是它们的图标丢失。

This code works like a charm on the simulator (both iphone and ipad, both ios7 and ios6), but on my device (an iPad with iOS7), when the ActivityViewController shows up, Twitter and FB are there, because the labels are visible, but their icons are missing.

在类似问题的中,声称问题是该应用程序是一个iphone应用程序,该设备是一个ipad(我无法检查,因为我的iPhone有iOS 6,这是完美的)。然而,

In this answer to a similar question it is claimed that the problem is that the app is an iphone app and the device is an ipad (I can't check this, because my iPhone has iOS 6, which works perfectly). However:


  • 为什么在iPad模拟器上正常工作?

  • 有什么办法在iOS 7运行iphone应用程序的ipad上正确显示图标?

推荐答案

iPad必须在popover中显示UIActivityViewController。对于iPhone和iPod,您必须以模态方式呈现。如果您已成功登录,UIActivityViewController会显示社交网络(Facebook和Twitter)图标。

On iPad you must present the UIActivityViewController in a popover. For iPhone and iPod you must present it modally. UIActivityViewController displays social networks(Facebook & Twitter) icons if you have successfully logged in.

这篇关于设备上iOS 7中的UIActivityViewController中没有显示Twitter图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 23:42