2012-12-14 105 views
0

我從我的iPhone應用程序,這兩個FB和Twitter的使用下面的代碼張貼到Twitter和Facebook

發佈,但我怎麼能直接發佈,而不顯示作曲家

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


} 

回答

0

使用在SLRequest類下面的方法來得到一個Request對象

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

然後張貼請求

performRequestWithHandler 
+0

如何使用......? 請給我一個正確的想法與我的上述代碼 –