简体   繁体   English

从iPhone应用程序发布到Twitter和Facebook

[英]posting from iphone app to twitter and facebook

I am posting from my iphone app to both FB and twitter using the below code 我使用以下代码从我的iPhone应用程序发布到FB和Twitter

But how can i post directly without showing a composer 但是我怎么能不发表作曲家直接发表

 -(IBAction)fbposting{

   if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook ]) {


    slComplose = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
    [slComplose addImage:imageV.image];
    [slComplose addURL:[NSURL URLWithString:@"http://newagesmb.com"]];

    [slComplose setInitialText:self.textView.text];
    [self presentViewController:slComplose animated:YES completion:nil];


}

[self.textView resignFirstResponder]; [self.textView resignFirstResponder];

} }

-(IBAction)twitposting{
   if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter ]) {


    slComplose = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
    [slComplose setInitialText:self.textView.text];
    [slComplose addURL:[NSURL URLWithString:@"http://newagesmb.com"]];

    [slComplose addImage:imageV.image];

    [self presentViewController:slComplose animated:YES completion:nil];

   }
   [self.textView resignFirstResponder];


}

Use following method in SLRequest class to get a Request object 在SLRequest类中使用以下方法获取Request对象

+(SLRequest *)requestForServiceType:(NSString *)serviceType requestMethod:(SLRequestMethod)requestMethod URL:(NSURL *)url parameters:(NSDictionary *)parameters

then post the request 然后发布请求

performRequestWithHandler

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM