簡體   English   中英

從iPhone應用程序發布到Twitter和Facebook

[英]posting from iphone app to twitter and facebook

我使用以下代碼從我的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];


}

在SLRequest類中使用以下方法獲取Request對象

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

然后發布請求

performRequestWithHandler

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM