我想通過WhatsApp分享鏈接,並閱讀了很多教程。我能夠成功地分享我的鏈接,但問題是用戶在共享whatsapp後沒有回到我的應用程序。whatsapp URL Scheme不會將控制權交還給應用程序。
這裏是我使用的共享代碼:
NSString *referralLink = [NSString stringWithFormat:@"some link here"];
NSString *textToSend = [[NSString stringWithFormat:@"whatsapp://send?text=%@",referralLink] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *whatsappURL = [NSURL URLWithString:textToSend];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
}
我知道,我必須使用URL方案來實現這一目標,我已經太習慣了。但我不確定我是否正確使用它。
下面是我的.info文件的截圖。
黑條後面,我已進入包標識符。即com.abc.myapp
我已經取代了WhatsApp與我的應用程序的名字,但仍然相同的行爲。 – iBug
@codeBug在發送消息後,WhatsApp永遠不會打開您的應用程序。由於這不是iOS中的默認行爲。所以只有當WhatsApp的開發者添加了這個功能,並且他們給了你什麼要添加到他們的應用程序方案重新打開你的願望的可能性。 – rckoenes