2016-04-26 184 views
-1

當我通過使用UIActiviyViewController的應用程序共享鏈接時,它顯示一個空白的tableView?WhatsApp分享在UIActivityViewController iOS中不工作?

UIActivityViewController *ACVcontroller =[[UIActivityViewController alloc]initWithActivityItems:@[text,tinyURL,append] 
                         applicationActivities:nil]; 
[self presentViewController:ACVcontroller animated:YES completion:nil]; 
+0

隨着WhatsApp的AFAIK您只能共享同一個圖像或一些文字。 – SeanLintern88

+0

主席先生,我只分享文本 –

+0

「What's App」與「WhatsApp」意思完全不同。 – peterh

回答

0

使用WhatsApp API:http://www.whatsapp.com/faq/en/iphone/23559013

從Objective-C的僅發送文字試試這個

NSString * msg = @"YOUR MSG To Share"; 
NSString * urlWhats = [NSString stringWithFormat:@"whatsapp://send?text=%@",msg]; 
NSURL * whatsappURL = [NSURL URLWithString:[urlWhats stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; 
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) { 
    [[UIApplication sharedApplication] openURL: whatsappURL]; 
} else { 
    // Cannot open whatsapp 
} 
+0

我在哪寫這段代碼? –

+0

關於whatsapp分享按鈕 –

+0

我使用UIActivityViewController Sir –

相關問題