我正在创建一个应用程序,用户可以在其中共享不同的表单。奇怪的是,当我在 iPhone 上测试应用程序时,Activity View 控制器工作正常
但是当我在 ipad 上做完全相同的事情时,但在不同的故事板上。它这样做:
以下是这两个视图获取操作的代码:
#import "FluteS.h"
#import "TUSafariActivity.h"
#import "ARChromeActivity.h"
@interface FluteS ()
@end
@implementation FluteS
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
-(IBAction)actionButton:(id)sender;{
NSLog(@"actionButton pressed");
NSBundle *bundle=[NSBundle mainBundle];
NSString *filePath = [bundle pathForResource:@"Flute" ofType: @"pdf"];
NSURL *fileURL= [NSURL URLWithString:@"http://www.friendswoodmustangband.org/wp-content/uploads/2012/04/Flute-Audition-Scales1.pdf"];
NSURL *fileUrl = [NSURL fileURLWithPath:filePath];
NSArray *activityItems = @[fileUrl, fileURL];
ARChromeActivity *chromeActivity = [[ARChromeActivity alloc] init];
TUSafariActivity *TUSafari = [[TUSafariActivity alloc] init];
NSArray *applicationActivities = [NSArray arrayWithObjects:TUSafari,chromeActivity, nil];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities: applicationActivities];
activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypePostToWeibo];
[self presentViewController:activityVC animated:YES completion:nil];
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSBundle *bundle=[NSBundle mainBundle];
NSString *filePath = [bundle pathForResource:@"Flute" ofType: @"pdf"];
NSURL *fileUrl = [NSURL fileURLWithPath:filePath];
NSURLRequest *request = [NSURLRequest requestWithURL:fileUrl];
[_webView loadRequest:request];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
我已经检查了 Info.plist 的本地化部分,但我无法弄清楚为什么它可以在 iPhone 上运行,但在 iPad 上却不行。有人知道发生了什么吗?