I am trying to open, linkedin app from my ios app. It is getting opened but with the user's home page. I want it to open with some profile. How can i send the profile id or name with custom url.
try this:
NSString *actionUrl = #"linkedin://#profile/52458178";
NSString *actionUrlWeb = #"http://www.linkedin.com/in/chetankedawat";
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:actionUrl]];
if (canOpenURL){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:actionUrl]];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:actionUrlWeb]];
}
Related
NSString *customURL = #"mycustomurl://";
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
} else {
...
}
The app returns true for 'canOpenURL', even if the target app that exposes the custom URL is not installed. This behaviour occurs on both phone & simulator. openURL then silently fails. Any ideas why this is happening/how to catch this condition?
If using an app with SDK 9.0 and up, then you will have to make sure to add the app schemes you want to open in your main app's info.plist:
Without adding the above to the main app's info.plist (change schemes accordingly) canOpenURL will always return NO. Unless using an app with iOS SDK lower then 9.0 then it won't happen.
Also, use the following logic as it is safer:
NSString * urlStr = #"mycustomurl://";
NSURL * url = [NSURL URLWithString:urlStr];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
if([[UIApplication sharedApplication] openURL:url]) {
// App opened
} else {
// App not opened
}
} else {
// Can not open URL
}
Last check I suggest is to open Safari app in the device, enter the app scheme url string in the url field, press enter. Conclude from the result how to proceed.
Ensure that you are using LSApplicationQueriesSchemes instead of URL types
It works well only for LSApplicationQueriesSchemes
This will not work
This will work
This is what i have used to open Uber app if it is installed else open Uber Website
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"uber://"]])
{
//Uber is installed
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"uber://"]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://uber.com"]];
}
Do not forget to add this LSApplicationQueriesSchemes in your info.plist file
Like this (the names of the app uber and twitter has been included in this) info.plist screenshot
I had implemented a module for opening Skype app for various modules chat ,call, video call.It was working till iOS 8.
Below is link is followed for integration
https://msdn.microsoft.com/en-us/library/dn745885.aspx
But it stopped working in iOS 9 now.
The below code is just opening the App-store searching Skype even when Skype is installed
BOOL installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"skype:"]];
if(installed)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"skype:%#?chat",dataSource[indexPath.section]]]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://itunes.apple.com/in/app/skype-for-iphone/id304878510?mt=8"]];
}
Any Alternative for this?Please guide.Thanks
Below i am sharing the image which worked for me.
I added the key LSApplicationQueriesSchemes in Info.plist file for skype
BOOL installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"skype:"]];
if(installed)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"skype:%#?chat",dataSource[indexPath.section]]]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://itunes.apple.com/in/app/skype-for-iphone/id304878510?mt=8"]];
}
Hi i am new for Ios app in my project i have added the facility for user make call from ios app to skype
for this i have installed skype in my device and when i made call call from my app call not going
What I have tried so far is the following:
NSString * userNameString = #"sarithasai";
NSString* urlString = [NSString stringWithFormat:#";skype://%#?call", userNameString];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
According to the Skype URI tutorial: iOS apps by MSDN your schema is wrong. You should probably use the following instead:
NSString *urlString = [NSString stringWithFormat:#"skype:%#?call", userNameString];
Note that you should check wether or not Skype is installed beforehand which is mentioned in the linked article as well.
To start a chat use the schema
skype:user?chat
To start a video call use
skype:user?call&video=true
Try this code,
BOOL installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"skype:"]];
if(installed)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"skype:%#?call", userNameString]]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://itunes.com/apps/skype/skype"]];
}
for more detail follow here.
Im trying to open my Facebook app page from iPhone.
Im using this:
[[UIApplication sharedApplication] openURL:[NSURL
URLWithString:#"http://www.facebook.com/(my page name)"]];
Unfortunately, this redirects to https protocol, and because of that the device is unable to open the page.
What can I do to open this page?
pass your Page ID - xxxxxx not the page Name
[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"fb://profile/herepassyourPageID"]];
or
[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://www.facebook.com/herepassyourPageID (id, not name)"]];
You are mistaken by using page name instead of page ID.
You should use something like below:
NSURL *facebookURL = [NSURL URLWithString:#"fb://profile/{pageid}"];
if ([[UIApplication sharedApplication] canOpenURL:facebookURL]) {
[[UIApplication sharedApplication] openURL:facebookURL];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#""https://www.facebook.com/{pageid}"]];
}
[If desired]: You should check the availability of installed facebook app to open the page, as shown in the above code sample.
I'm trying to integrate my app with waze.
Anyone know how can I call waze and send the coordinates?
I didn’t find any API or other information about it..
- (void) navigateToLatitude:(double)latitude
longitude:(double)longitude
{
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"waze://"]]) {
//Waze is installed. Launch Waze and start navigation
NSString *urlStr = [NSString stringWithFormat:#"waze://?ll=%f,%f&navigate=yes", latitude, longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];
} else {
//Waze is not installed. Launch AppStore to install Waze app
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://itunes.apple.com/us/app/id323229106"]];
}
}