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
-(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