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.
Related
Is there a way to launch safari only? I know in order to send an intent and have ios to handle it we can do [[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://"]];, but if user has other browser installed (i.e. chrome), there's no guarantee safari will be used.
Reason I want to use safari is that I'm trying to have safari to handle certificate authentication for me, and according to here, only system app has permission to do so
try this
//initially we need to check safari is installed or not in our device
NSURL *url = [NSURL URLWithString:#"safari://"];
UIApplication *application = [UIApplication sharedApplication];
if ([application canOpenURL:url]) {
// if success again need to validate the our calling URL.
NSURL *linkURL = [NSURL URLWithString:#"https://iostree.wordpress.com/2017/07/29/launch-safari-from-ios-app/"];
if ([application canOpenURL:linkURL]) {
if ([application respondsToSelector:#selector(openURL:options:completionHandler:)]) {
[application openURL:linkURL options:#{}
completionHandler:^(BOOL success) {
NSLog(#"success");
}];
}
}
}else{
NSLog(#"safari is not installed");
}
I was using prefs:root=WIFI url scheme in my app with prefs entered in info.plist to open directly the iOS settings application in Wi-Fi settings and it was working great on iOS 9 but it does not work anymore on iOS 10.
Does anyone know if this is just a regression in the first developer preview or the way to open Wi-Fi settings has changed in iOS 10 or it is not allowed anymore?
Just so it's explicit: Apple does not allow this. It's possible your app will make it through anyway, but this is the same as using any other undocumented API.
Here is the full list of supported Apple URL schemes.
Here's a thread where Apple confirms that "any Apple URL schemes that are not officially documented should be considered private API."
SWIFT 3.0:- working in iOS 10
#IBAction func openWifiSetting(_ sender: AnyObject) {
let url = URL(string: "App-Prefs:root=WIFI") //for WIFI setting app
UIApplication.shared.openURL(url!)
}
My app is also using that api. Unfortunately apple disable this on iOS 10. Here's my solution: below iOS 10, it can still open Setting App. on iOS 10, it will go to a subpage(Cellular Data access) of Setting App, you can back to setting page by one click. I decide to keep it. because it's still convenient than user manually open Setting App.
NSURL *url = [NSURL URLWithString:#"prefs:root=WIFI"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
try this for objective c in iOS 10
NSURL *url = [NSURL URLWithString:#"prefs:root=WIFI"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"App-Prefs:root=WIFI"]];
}
Using "App-Prefs:root" instead of "prefs:root"
iOS 10, to open your apps settings:
if let settingsURL = URL(string: UIApplicationOpenSettingsURLString) {
UIApplication.shared.openURL(settingsURL)
}
This works fine on iOS 10,
Go to Targets --> (Application) --> Info --> URL Types --> +
In the URL Schemes write
prefs
Then Call,
- (void)openWifiSettings
{
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"prefs:root=WIFI"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=WIFI"]];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"App-Prefs:root=WIFI"]];
}
}
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
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 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]];
}