沒想到facebook又大改版所以一些步驟也都忘光光了
一開始都照著facebook文件一步一步去做
後來遇到怎樣都不行讓facebook的App激活起來
如圖

Do you want to make this app and all its live features available to the general public
選項要為YES
如圖


這樣App就正式搞定了

#import
@interface ViewController : UIViewController
{
IBOutlet UIImageView *img;
BOOL preview;
UIDocumentInteractionController *documentInteractionController;
}
@end
- (IBAction)shareDocument:(id)sender
{
NSURL *URL = [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"png"];
if (URL)
{
// Initialize Document Interaction Controller
documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
if (preview)
{
[documentInteractionController setDelegate:self];
[documentInteractionController presentPreviewAnimated:YES];
}
else
{
[documentInteractionController presentOpenInMenuFromRect:[sender frame] inView:self.view animated:YES];
}
}
}
#pragma mark -
#pragma mark - UIDocumentInteractionControllerDelegate
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return self;
}
- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
return self.view;
}
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
return self.view.frame;
}