Post

Replies

Boosts

Views

Activity

When creating a URL Object Part of my querystring is being removed when sharing on Messenger
I have a URL string that when shared it is sometimes (50% of the time) removing the querystring when shared on Message App via the activity view controller. Here is the code :func share() { // activity items to be shared var activityItems : [Any] = [] // This will return our site url https://www.myurl.com if let url_string = Config.getString("link_back_url") { // https://www.myurl.com/123457 var link_back = "\(url_string)/\((self.listing?.listno)!)" let agent = Agent.getDefault() if agent.isAgent { // https://www.myurl.com/123457?actor=1&share=ios link_back = link_back + "?&actor=\(agent.agentID)&share=ios" link_back = link_back.trimmingCharacters(in: .whitespacesAndNewlines) } // This is always (100% of the time) showing the correct url print(link_back) if let link_back_url = URL(string: link_back) { // The URL will not include the "actor" or "share" when I share on messages 50% of the time activityItems.append(link_back_url) // If I just append the string and not the url then it will always work but I don't get // the og:title, og:image to show up like it would when I share the url object } else { activityItems.append(link_back) } let vc = UIActivityViewController(activityItems: activityItems, applicationActivities: []) vc.popoverPresentationController?.sourceView = self.tabBar vc.popoverPresentationController?.sourceRect = CGRect(x: 280, y: 0, width: 1, height: 40) navigationController?.present(vc, animated: true, completion: nil); }
7
0
1.4k
Apr ’20