我想使用UIActivityViewController共享我的應用程序文檔(文件url)。當activityviewcontroller彈出(在iPad設備上測試)時,我只獲得iMessage和Mail選項。我沒有獲得Facebook,Twitter,複製,打印等其他選項。爲什麼?請幫幫我。我需要Facebook,Twitter的選項。我使用NSURL共享的文件類型是.txt使用UIActivityViewController發佈發佈文件url
注意:我已經登錄到我在iOS設置中的Facebook,Twitter帳戶。
我使用的源代碼:
NSURL * URL = [NSURL fileURLWithPath:self.path];
NSArray *objectsToShare = @[url];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
[APP_VIEW_CONTROLLER presentViewController:activityViewController animated:YES completion:nil];
}
else
{
if (![self.activityPopover isPopoverVisible]) {
self.activityPopover = [[UIPopoverController alloc] initWithContentViewController:activityViewController];
[self.activityPopover presentPopoverFromRect:pathViewController.pathViewWrapper.pathView.bounds inView:pathViewController.pathViewWrapper.pathView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
else
{
//Dismiss if the button is tapped while pop over is visible
[self.activityPopover dismissPopoverAnimated:YES];
}
}