I am not able to find popup for sharing link on LinkedIn.
I got REST API and also called successfully.
let url: String = "https://api.linkedin.com/v1/people/~/shares?format=json"
let payloadStr: String = "{\"comment\":\"I_SHARE_EXXO5__llEO_0009099\",\"visibility\":{\"code\":\"anyone\"}}"
let payloadData = payloadStr.data(using: String.Encoding.utf8)
LISDKAPIHelper.sharedInstance().postRequest(url, body: payloadData, success: { (response) in
Do i need to add custom popup from my side in app?
LinkedIn is not providing any dialog or popup for sharing text so if you need to show pop up you have to design your custom popup.
Related
// 1
let urlWhats = "https://wa.me/\(mobile)/?text=\(text)"
// 2
if let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed) {
// 3
if let whatsappURL = NSURL(string: urlString) {
// 4
if UIApplication.shared.canOpenURL(whatsappURL as URL) {
// 5
UIApplication.shared.open(whatsappURL as URL, options: [:], completionHandler: nil)
// UIApplication.shared.\
} else {
// 6
print("Cannot Open Whatsapp")
}
}
}
I'm able to launch whatsapp from my app from the above mentioned code, it is composing prefix text to the contact I wish to send and I need to click the send button in whatsapp manually . But I'm looking for a code which automatically sends whatsapp text to number from my app. Can anyone share your thoughts on this?
You can only compose the message for a particular contact using the Deep Linking method that you have used for it. For sending the message user has to click on the send button manually. You could provide the user with an alert that says so. But, it's not possible to do it for the user from your side. If you were able to send a message on Whatsapp by writing code without the user's confirmation it would be a break of user's privacy. Don't you think?
I am using universal link in iOS application. For the universal link I am using of Firebase dynamic link.
Universal link is working fine when app is installed. But when app is not installed then this link is opening in safari.
I am creating dynamic link (Universal link) programatically in Swift.
func createDynamicLinkForConsumer(){
guard let link = URL(string: "https://<Domain-Name>?consumerID=\(Auth.auth().currentUser?.uid ?? "")&type=consumerReferral") else { return }
let dynamicLinksDomainURIPrefix = "<appName>.page.link"
let linkBuilder = DynamicLinkComponents(link: link, domain: dynamicLinksDomainURIPrefix)
linkBuilder.options?.pathLength = .short
linkBuilder.iOSParameters = DynamicLinkIOSParameters(bundleID: "<Bundle-ID>")
linkBuilder.iOSParameters?.appStoreID = "<app-store-id>"
linkBuilder.androidParameters = DynamicLinkAndroidParameters(packageName: "<android package name>")
linkBuilder.navigationInfoParameters?.isForcedRedirectEnabled = true
guard let longDynamicLink = linkBuilder.url else { return }
print("The long URL is: \(longDynamicLink)")
self.referralLinkLabel.text = String(describing: longDynamicLink)
DynamicLinkComponents.shortenURL(longDynamicLink, options: nil) { (url, warnings, error) in
if url != nil {
print("Short URL is: \(url)")
self.referralLinkLabel.text = String(describing: url!)
}
}
}
This is the screen which opens after when safari opens the link:
After tapping on "Open" button of alert box browser opens app store app.
Actually what I would like to do is to redirect and go to the app store, so users can download the app directly. I don't want to this two steps to open app store.
You should first init DynamicLinkNavigationInfoParameters, then set property to true.
linkBuilder.navigationInfoParameters = DynamicLinkNavigationInfoParameters()
linkBuilder.navigationInfoParameters?.isForcedRedirectEnabled = true
Hi you can reduce these steps with this check on the dynamic link
But you should have in mind that you can have a problem with your link in Messanger app and some other apps.
I am trying to show a website through a WKWebView.
My problem is that I don't want to show the navigationBar of the WebSite.
It looks like I have to use webview.evaluateJavaScript but is there an other way of doing it. If NO, can you provide an example with webview.evaluateJavaScript
Thanks
Looking a bit online, I found that on the particular website you can check for navigator.userAgent.
Then I could use the following that helped me remove the content that I want
webView.evaluateJavaScript("navigator.userAgent") { [weak webView] (result, error) in
if let webView = webView, let userAgent = result as? String {
webView.customUserAgent = userAgent + "/_app_"
}
}
In order to open instagram app with certain post I'm using following code:
func instaOpen(_ postId: String, _ postUrl: String){
let appURL = URL(string: "instagram://media?id=\(postId)")!
if UIApplication.shared.canOpenURL(appURL) {
UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
} else {
// if Instagram app is not installed, open URL inside Safari
let webURL = URL(string: postUrl)!
let svc = SFSafariViewController(url: webURL)
present(svc, animated: true, completion: nil)
}
}
When instaOpen function called – instagram app opens, but login prompt forcefully pops over. Not matter what you do - close it or proceed with login, the queried post simply won't open(see gif).
This started happening recently, after I've updated my app and pushed deployment target to iOS12.
I do have instagram listed in my LSApplicationQueriesSchemes as well as I'm 100% positive that correct mediaID is being passed to instaOpen func (the code worked previously).
Let me know if there's any suggestions on how to fix this and actually open instagram post in instagram app.
Updated - Facebook developer fixed the issue.
Its instagram bug you can follow its progress from https://developers.facebook.com/support/bugs/290173615155052/?disable_redirect=0
Probably a bug, as that feature works on Android.
i manage to "fix" the problem on a pwa app using the Instagram web app.
let appURL = URL(string: "https://www.instagram.com/p/\(postId)")!
//https://www.instagram.com/p/insert here media id
I am developing an iOS application with a button to report an issue using SMS/iMessage. I am using MFMessageComposeViewController to present the message composition interface using the following code (Swift 3):
if(MFMessageComposeViewController.canSendText()){
let controller = MFMessageComposeViewController()
controller.messageComposeDelegate = self
controller.body = "Example Message"
controller.recipients = ["2345678901"]
self.present(controller, animated: true, completion: nil)
}
I have also implemented the MFMessageComposeViewControllerDelegate function to dismiss properly. A standard text message / iMessage sends successfully, but the user does not have the option to attach an image. The buttons for camera, iMessage Apps, etc. are there, but they are disabled and cannot be pressed. How can I enable these buttons (camera, specifically) to allow my users to attach images to messages composed with the app?
The Buttons in Question:
EDIT:
Thanks Abdelahad for the suggestion. I've modified his response to allow multiple recipients and to include a message body. I also updated it to remove the deprecated addingPercentEscapes(using: ) method.
Here is a solution using a url to open the Messages app. NOTE: This takes users out of the app.
let recipients = "2345678901,3456789012" //Phone Numbers
let messageBody = "This is a test"
let sms: String = "sms://open?addresses=\(recipients)&body=\(messageBody)"
let smsEncoded = sms.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed)
let url = URL(string: smsEncoded!)
UIApplication.shared.openURL(url!)
But still I would like a solution that does not take the user out of the app. Is this possible? Why would the MFMessageComposeViewController show the buttons without enabling them?
Don't use MFMessageComposeViewController use UIApplication.shared.openURL(url!) but this will takes the user out of the app
var phoneToCall: String = "sms: +201016588557"
var phoneToCallEncoded = phoneToCall.addingPercentEscapes(using: String.Encoding.ascii)
var url = URL(string: phoneToCallEncoded)
UIApplication.shared.openURL(url!)