i am using Facebook & Twitter sharing in my app , after upgrade xCode to 9.0.1 Swift 4, both are not working , the method saying i have no FB or Tw account on my device but
You have to use Facebook's SDK to share: FBSDKShareKit
You can install it using cocoa pods:
pod 'FBSDKShareKit'
Example
#import <FBSDKShareKit/FBSDKShareKit.h>
-(IBAction)sharingOnFacebook:(id)sender {
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"https://myPageWeb/"];
[FBSDKShareDialog showFromViewController:self withContent:content delegate:nil];
}
And for Twitter the steps are similar: TwitterKit
pod 'TwitterKit'
Example:
-(IBAction)sharingOnTwitter:(id)sender {
TWTRComposer *composer = [[TWTRComposer alloc] init];
[composer setURL:[NSURL URLWithString:@"https://https://myPageWeb/"]];
[composer showFromViewController:self completion:^(TWTRComposerResult result) {
/*if (result == TWTRComposerResultCancelled) {
NSLog(@"Tweet composition cancelled");
} else {
NSLog(@"Sending Tweet!");
}*/
}];
}
NOTE: Read Facebook and Twitter documentation because you need to do some steps for your app previously. Register the app, get the AppID...
Facebook iOS Developers
Twitter iOS Developers page
Those have been disabled with iOS 11. You should no longer see the Facebook NOR twitter sub-menus in the iOS Settings app.
I would suggest you to use the regular sharing options or the fb/twitter APIs.
Vincent
Dont check if its available anymore; isAvailable(forServiceType:), just run it direct. I faced similar issue myself