2
我想讓按鈕在Facebook上與社交框架共享。我做到這一點:Social.framework在設備上不起作用
#import <UIKit/UIKit.h>
#import <Social/Social.h>
@interface SocialSharingViewController : UIViewController
- (IBAction)postToFacebook:(id)sender;
@end
然後我加入米。文件:
- (IBAction)postToFacebook:(id)sender {
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"First post from my iPhone app"];
[self presentViewController:controller animated:YES completion:Nil];
}
}
它的工作完美的模擬器,但是當我在我的iPhone 5設備上測試這是行不通的。當我點擊按鈕postToFacebook什麼也沒有發生。
普萊斯幫我