从iphone应用程序发布到twitter和facebook

时间:2012-12-14 09:30:26

标签: iphone objective-c ios facebook twitter

我使用以下代码从我的iphone应用程序发布到FB和Twitter

但是如何直接发布而不显示作曲家

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

}

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


}

1 个答案:

答案 0 :(得分:0)

在SLRequest类中使用以下方法来获取Request对象

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

然后发布请求

performRequestWithHandler