UIActivityController在设备和模拟器上的行为不同 [英] UIActivityController behaviour different on device and simulator

查看:94
本文介绍了UIActivityController在设备和模拟器上的行为不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用中添加了一个activityViewController,如下图所示,传入图像

I add an activityViewController to my app like below, passing in an image

UIActivityViewController *avc = [[UIActivityViewController alloc]initWithActivityItems:[NSArray arrayWithObjects:img,nil] applicationActivities:[NSArray arrayWithObjects:nil]];
        [self presentModalViewController:avc animated:YES];
        [avc release];

在模拟器上(所有未配置的推特,facebook和微博账号):

选项邮件,推特,脸书,微博,分配给联系人,保存到相机胶卷,打印和复印默认显示。

options mail, twitter, facebook, weibo, assign to contact, save to camera roll, print, and copy appear by default.

,但在设备上:

在我的应用中:twitter,facebook和weibo仅显示帐户是否已配置。

in my app: twitter, facebook and weibo only show if the accounts are configured.

在safari中:无论帐户是否配置,都可以使用Twitter,facebook和微博选项。

in safari: twitter, facebook and weibo options are available irregardless of whether the accounts are configured.

I我希望我的应用程序中的行为与safari相同。我错过了一个特定的步骤吗?

I am expecting the same behaviour in my app as safari. am I missing a particular step?

推荐答案

好的我已经找到了问题。

Okay I have figured the problem.

UIActivityViewController中显示的选项完全取决于要共享的项目类型。例如,如果有视频,则不会显示Facebook或Twitter选项。但如果它是一个图像和标题,它肯定会显示相关的选项。

The options shown in the UIActivityViewController totally depends on the type of items that are to be shared. For example, if there is a video, it will not show Facebook or twitter option. But if it's an image and title, it definitely will show the relevant options.

以下内容将显示邮件,推特,Facebook,assignToContact,保存到相机胶卷,打印,复印等应用程序

The following will show up apps like mail, twitter, Facebook, assignToContact, save to camera roll, print, copy, etc

// Create the content
NSString *message = @"The Upcoming App Scribble Talk";
UIImage *imageToShare = [UIImage imageNamed:@"createbtn.png"];

NSArray *objectsToShare = [NSArray arrayWithObjects:message, image, nil];

但是,以下内容仅提供相机胶卷,邮件或复印件。

However, the following shall bring up only camera roll, mail or copy.

NSString *message = @"The Upcoming App Scribble Talk";
NSString *videoToShare = @"myFirsScribble.mov";
NSURL *videoPath = [NSURL fileURLWithPath:videoToShare];

NSArray *objectsToShare = [NSArray arrayWithObjects:message, videoPath, nil];

这篇关于UIActivityController在设备和模拟器上的行为不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆