ios - Whatsapp 共享文本和图像在 ios 中不起作用
<p><p>如果向 WhatsApp 发送文本:</p>
<pre><code>NSString *msg = @"Some Text";
NSString *urlWhats = ;
NSURL *whatsappURL = ];
if ([ canOpenURL: whatsappURL]) {
[ openURL: whatsappURL];
} else {
UIAlertView * alert = [ initWithTitle:@"WhatsApp not installed." message:@"Your device has no WhatsApp installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
;
}
</code></pre>
<p>如果将图像发送到 WhatsApp:</p>
<pre><code>if ([ canOpenURL: ]){
UIImage* iconImage = ;// this will return a image
NSString* savePath= ;
;
_documentInteractionController = ];
_documentInteractionController.UTI = @"net.whatsapp.image";
_documentInteractionController.delegate = self;
;
} else {
UIAlertView * alert = [ initWithTitle:@"WhatsApp not installed." message:@"Your device has no WhatsApp installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
;
}
</code></pre>
<p>Whatsapp 打开时没有任何用于文本共享的文本,并且图像也没有被共享。请帮我。 </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您是否将“LSApplicationQueriesSchemes”添加到您的 plist 中?</p>
<ol>
<li>转到您的项目/Supporting Files/YourProjectName-Info.plist 中
XCode 项目资源管理器。 </li>
<li>添加新的键值对。 key:
LSApplicationQueriesSchemes 类型:数组添加一个新的字符串项
“whatsapp”</li>
</ol>
<p>请试试这个,如果它仍然不起作用,请告诉我。</p></p>
<p style="font-size: 20px;">关于ios - Whatsapp 共享文本和图像在 ios 中不起作用,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/27105098/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/27105098/
</a>
</p>
页:
[1]